aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/backend/rust-compile-base.cc')
-rw-r--r--gcc/rust/backend/rust-compile-base.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index 2b5c850..ab330c4 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -56,6 +56,7 @@ HIRCompileBase::setup_fndecl (tree fndecl, bool is_main_entry_point,
}
// is it a const fn
+ DECL_DECLARED_CONSTEXPR_P (fndecl) = qualifiers.is_const ();
if (qualifiers.is_const ())
{
TREE_READONLY (fndecl) = 1;
@@ -630,6 +631,11 @@ HIRCompileBase::compile_function (
ctx->pop_fn ();
ctx->push_function (fndecl);
+ if (DECL_DECLARED_CONSTEXPR_P (fndecl))
+ {
+ maybe_save_constexpr_fundef (fndecl);
+ }
+
return fndecl;
}