diff options
Diffstat (limited to 'gcc/cp/constexpr.cc')
-rw-r--r-- | gcc/cp/constexpr.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 8f7f0b7..9122a5e 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -2897,7 +2897,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, /* We can't defer instantiating the function any longer. */ if (!DECL_INITIAL (fun) - && DECL_TEMPLOID_INSTANTIATION (fun) + && (DECL_TEMPLOID_INSTANTIATION (fun) || DECL_DEFAULTED_FN (fun)) && !uid_sensitive_constexpr_evaluation_p ()) { location_t save_loc = input_location; @@ -2905,7 +2905,10 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, ++function_depth; if (ctx->manifestly_const_eval == mce_true) FNDECL_MANIFESTLY_CONST_EVALUATED (fun) = true; - instantiate_decl (fun, /*defer_ok*/false, /*expl_inst*/false); + if (DECL_TEMPLOID_INSTANTIATION (fun)) + instantiate_decl (fun, /*defer_ok*/false, /*expl_inst*/false); + else + synthesize_method (fun); --function_depth; input_location = save_loc; } @@ -8110,11 +8113,14 @@ instantiate_cx_fn_r (tree *tp, int *walk_subtrees, void */*data*/) && DECL_DECLARED_CONSTEXPR_P (*tp) && !DECL_INITIAL (*tp) && !trivial_fn_p (*tp) - && DECL_TEMPLOID_INSTANTIATION (*tp) + && (DECL_TEMPLOID_INSTANTIATION (*tp) || DECL_DEFAULTED_FN (*tp)) && !uid_sensitive_constexpr_evaluation_p ()) { ++function_depth; - instantiate_decl (*tp, /*defer_ok*/false, /*expl_inst*/false); + if (DECL_TEMPLOID_INSTANTIATION (*tp)) + instantiate_decl (*tp, /*defer_ok*/false, /*expl_inst*/false); + else + synthesize_method (*tp); --function_depth; } else if (TREE_CODE (*tp) == CALL_EXPR |