8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/initlist-array9.C
Jason Merrill 8b5d34fc06 PR c++/93033 - incorrect tree node sharing with array init.
The split_nonconstant_init piece is the only one necessary to fix the
testcase, but it occurred to me that we might as well not split when
-fno-exceptions.

	* typeck2.c (split_nonconstant_init): Unshare non-decl.
	* cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.

From-SVN: r279871
2020-01-03 17:10:56 -05:00

21 lines
160 B
C

// PR c++/93033
// { dg-do compile { target c++11 } }
struct A {
A ();
~A ();
};
A f();
struct B {
A a;
bool b;
};
void
foo ()
{
B i[] { f() };
}