From: Paolo Carlini Date: Fri, 17 Jan 2014 20:25:01 +0000 (+0000) Subject: re PR c++/59270 ([c++11] ICE with decltype of a broken class) X-Git-Tag: releases/gcc-4.9.0~1598 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a95aef3c126b193ad4f7cf6bed6c40534236bc0b;p=thirdparty%2Fgcc.git re PR c++/59270 ([c++11] ICE with decltype of a broken class) /cp 2014-01-17 Paolo Carlini PR c++/59270 PR c++/58811 * init.c (build_value_init_noctor): Don't pass error_mark_node to build_value_init. /testsuite 2014-01-17 Paolo Carlini PR c++/59270 PR c++/58811 * g++.dg/cpp0x/decltype-incomplete1.C: New. * g++.dg/init/pr58811.C: Likewise. From-SVN: r206731 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 45a6c9778e82..0508ea07862a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2014-01-17 Paolo Carlini + + PR c++/59270 + PR c++/58811 + * init.c (build_value_init_noctor): Don't pass error_mark_node to + build_value_init. + 2014-01-17 Paolo Carlini PR c++/59269 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 931b5c8c1d25..194a79777f47 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -400,6 +400,9 @@ build_value_init_noctor (tree type, tsubst_flags_t complain) ftype = TREE_TYPE (field); + if (ftype == error_mark_node) + continue; + /* We could skip vfields and fields of types with user-defined constructors, but I think that won't improve performance at all; it should be simpler in general just diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5d80c8e9237b..c471ae98aa94 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-01-17 Paolo Carlini + + PR c++/59270 + PR c++/58811 + * g++.dg/cpp0x/decltype-incomplete1.C: New. + * g++.dg/init/pr58811.C: Likewise. + 2014-01-17 Jeff Law PR middle-end/57904 diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-incomplete1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-incomplete1.C new file mode 100644 index 000000000000..f46d0ba4194f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-incomplete1.C @@ -0,0 +1,9 @@ +// PR c++/59270 +// { dg-do compile { target c++11 } } + +struct A +{ + struct B b; // { dg-error "incomplete type" } +}; + +decltype(A()) a; diff --git a/gcc/testsuite/g++.dg/init/pr58811.C b/gcc/testsuite/g++.dg/init/pr58811.C new file mode 100644 index 000000000000..42e7fac42f78 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/pr58811.C @@ -0,0 +1,11 @@ +// PR c++/58811 + +struct B +{ + struct A a; // { dg-error "incomplete type" } +}; + +void foo() +{ + B(); +}