aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-resolve-path.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-04-29 15:27:53 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-04-30 13:31:12 +0100
commit44c058c30dd1d36f87c36f2c487355a5736d0afc (patch)
tree9414376dc8e452c4bd69ec5a776daeb25db979c8 /gcc/rust/backend/rust-compile-resolve-path.cc
parentf38bf60c3ac7f039db5ff5c7c0587325097892c8 (diff)
downloadgcc-44c058c30dd1d36f87c36f2c487355a5736d0afc.zip
gcc-44c058c30dd1d36f87c36f2c487355a5736d0afc.tar.gz
gcc-44c058c30dd1d36f87c36f2c487355a5736d0afc.tar.bz2
Fix address expression to respect reference/pointer types
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.cc')
-rw-r--r--gcc/rust/backend/rust-compile-resolve-path.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc
index 55a2fff..bd44bf4 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -141,14 +141,16 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment,
if (ctx->lookup_function_decl (fntype->get_ty_ref (), &fn))
{
TREE_USED (fn) = 1;
- return address_expression (fn, expr_locus);
+ return address_expression (fn, build_pointer_type (TREE_TYPE (fn)),
+ expr_locus);
}
else if (fntype->get_abi () == ABI::INTRINSIC)
{
Intrinsics compile (ctx);
fn = compile.compile (fntype);
TREE_USED (fn) = 1;
- return address_expression (fn, expr_locus);
+ return address_expression (fn, build_pointer_type (TREE_TYPE (fn)),
+ expr_locus);
}
}