diff options
author | Jason Merrill <jason@redhat.com> | 2011-08-13 20:03:15 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2011-08-13 20:03:15 +0000 |
commit | c0c4e941b5f5939fc85d62ee39efe871b67db5dc (patch) | |
tree | d1a26b0e6b8ac0a2444e251e1b2058c472f2a219 | |
parent | 4d92fc44b947789536f963ce3780371aa60f16c9 (diff) |
* decl.c (grok_reference_init): Handle constexpr here.
* call.c (initialize_reference): Not here.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@177734 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bb6d614fb3c..bc33588f9d3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-08-13 Jason Merrill <jason@redhat.com> + + * decl.c (grok_reference_init): Handle constexpr here. + * call.c (initialize_reference): Not here. + 2011-08-12 Jason Merrill <jason@redhat.com> PR c++/50034 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e8fb68d833a..d2700cbeac8 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -8820,12 +8820,6 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup, (build_pointer_type (base_conv_type), expr, complain)); expr = build_nop (type, expr); - if (DECL_DECLARED_CONSTEXPR_P (decl)) - { - expr = cxx_constant_value (expr); - DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) - = reduced_constant_expression_p (expr); - } } } else diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1db074809c8..c125f05478e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4597,6 +4597,12 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup) explicitly); we need to allow the temporary to be initialized first. */ tmp = initialize_reference (type, init, decl, cleanup, tf_warning_or_error); + if (DECL_DECLARED_CONSTEXPR_P (decl)) + { + tmp = cxx_constant_value (tmp); + DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) + = reduced_constant_expression_p (tmp); + } if (tmp == error_mark_node) return NULL_TREE; |