Commit 515756b9 by Jason Merrill Committed by Jason Merrill

decl.c (grok_reference_init): Handle constexpr here.

	* decl.c (grok_reference_init): Handle constexpr here.
	* call.c (initialize_reference): Not here.

From-SVN: r177734
parent 8434c305
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> 2011-08-12 Jason Merrill <jason@redhat.com>
PR c++/50034 PR c++/50034
......
...@@ -8820,12 +8820,6 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup, ...@@ -8820,12 +8820,6 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup,
(build_pointer_type (base_conv_type), expr, (build_pointer_type (base_conv_type), expr,
complain)); complain));
expr = build_nop (type, expr); 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 else
......
...@@ -4597,6 +4597,12 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup) ...@@ -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 explicitly); we need to allow the temporary to be initialized
first. */ first. */
tmp = initialize_reference (type, init, decl, cleanup, tf_warning_or_error); 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) if (tmp == error_mark_node)
return NULL_TREE; return NULL_TREE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment