From: Jason Merrill Date: Sat, 6 Aug 2011 04:34:29 +0000 (-0400) Subject: re PR c++/49669 ([C++0x] Compiler crashes with "internal compiler error: in perform_m... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd56ca9f1c8d3a236474453de81433a7c911f71b;p=gcc.git re PR c++/49669 ([C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530") PR c++/49669 * init.c (perform_member_init): Handle invalid array initializer. From-SVN: r177497 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3c1ad7f5959..964de150272 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-08-05 Jason Merrill + PR c++/49669 + * init.c (perform_member_init): Handle invalid array initializer. + PR c++/49988 * semantics.c (cxx_eval_array_reference): Handle failure to reduce the array operand to something we can work with. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index d9e475e79de..4fa627ba8c0 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -554,8 +554,10 @@ perform_member_init (tree member, tree init) { if (init) { - gcc_assert (TREE_CHAIN (init) == NULL_TREE); - init = TREE_VALUE (init); + if (TREE_CHAIN (init)) + init = error_mark_node; + else + init = TREE_VALUE (init); if (BRACE_ENCLOSED_INITIALIZER_P (init)) init = digest_init (type, init, tf_warning_or_error); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af49861a64b..9ce5d9b75f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-08-05 Jason Merrill + PR c++/49669 + * g++.dg/init/array28.C: New. + PR c++/49988 * g++.dg/cpp0x/constexpr-non-const-arg3.C: New. diff --git a/gcc/testsuite/g++.dg/init/array28.C b/gcc/testsuite/g++.dg/init/array28.C new file mode 100644 index 00000000000..8cf19ba4331 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array28.C @@ -0,0 +1,7 @@ +// PR c++/49669 + +struct Foo { explicit Foo(int) { } }; +struct Goo { + Goo() : x(Foo(4), Foo(5)) { } // { dg-error "array" } + Foo x[2]; +};