diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-25 21:29:26 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-25 21:29:26 +0000 |
commit | a478a028f1e445c05b162236d708de6935d4b5e2 (patch) | |
tree | 539f2664a65fff87648c21b1f5ed7a833fe023c8 /gcc/cp/pt.c | |
parent | b0bf58c4cc30f551c21b51facb916ff8fa8ec746 (diff) | |
download | gcc-a478a028f1e445c05b162236d708de6935d4b5e2.tar.gz |
PR c++/64266
PR c++/70353
Core issue 1962
* decl.c (cp_fname_init): Decay the initializer to pointer.
(cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
Don't call cp_finish_decl.
* pt.c (tsubst_expr) [DECL_EXPR]: Set DECL_VALUE_EXPR,
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. Don't call cp_finish_decl.
* constexpr.c (cxx_eval_constant_expression) [VAR_DECL]:
Handle DECL_VALUE_EXPR.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234484 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a6398c04f85..e0b7a2a90aa 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15194,21 +15194,25 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, DECL_CONTEXT (decl) = current_function_decl; cp_check_omp_declare_reduction (decl); } + else if (VAR_P (decl) + && DECL_PRETTY_FUNCTION_P (decl)) + { + /* For __PRETTY_FUNCTION__ we have to adjust the + initializer. */ + const char *const name + = cxx_printable_name (current_function_decl, 2); + init = cp_fname_init (name, &TREE_TYPE (decl)); + SET_DECL_VALUE_EXPR (decl, init); + DECL_HAS_VALUE_EXPR_P (decl) = 1; + DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = 1; + maybe_push_decl (decl); + } else { int const_init = false; maybe_push_decl (decl); - if (VAR_P (decl) - && DECL_PRETTY_FUNCTION_P (decl)) - { - /* For __PRETTY_FUNCTION__ we have to adjust the - initializer. */ - const char *const name - = cxx_printable_name (current_function_decl, 2); - init = cp_fname_init (name, &TREE_TYPE (decl)); - } - else - init = tsubst_init (init, decl, args, complain, in_decl); + + init = tsubst_init (init, decl, args, complain, in_decl); if (VAR_P (decl)) const_init = (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P |