Commit 1ea3b987 by Jason Merrill Committed by Jason Merrill

re PR c++/58611 ([c++11] ICE with invalid constexpr constructor used in array initialization)

	PR c++/58611
	* decl.c (check_initializer): Don't finish_compound_literal
	on erroneous constexpr init.

From-SVN: r212506
parent 22c6ea00
2014-07-13 Jason Merrill <jason@redhat.com>
PR c++/58611
* decl.c (check_initializer): Don't finish_compound_literal
on erroneous constexpr init.
PR c++/58612
* tree.c (bot_replace): Only replace a dummy 'this' parm.
......
......@@ -5812,10 +5812,7 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
/* Declared constexpr, but no suitable initializer; massage
init appropriately so we can pass it into store_init_value
for the error. */
if (init && BRACE_ENCLOSED_INITIALIZER_P (init))
init = finish_compound_literal (type, init,
tf_warning_or_error);
else if (CLASS_TYPE_P (type)
if (CLASS_TYPE_P (type)
&& (!init || TREE_CODE (init) == TREE_LIST))
{
init = build_functional_cast (type, init, tf_none);
......
// PR c++/58611
// { dg-do compile { target c++11 } }
struct A
{
int i;
constexpr A() {} // { dg-error "A::i" }
};
struct B
{
A a;
};
constexpr B b[] = { {} }; // { dg-error "A::A" }
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