From: Jakub Jelinek Date: Fri, 2 Dec 2016 21:23:22 +0000 (+0100) Subject: re PR c++/78649 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a3f7c896a55c33e369f9bbb210f4b43a345beabe;p=gcc.git re PR c++/78649 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_value_init_noctor, at cp/init.c:380)) PR c++/78649 * pt.c (tsubst_init): Don't call build_value_init if decl's type is error_mark_node. * g++.dg/cpp0x/pr78649.C: New test. From-SVN: r243204 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d39c222d16a..f16813d1be0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-12-02 Jakub Jelinek + + PR c++/78649 + * pt.c (tsubst_init): Don't call build_value_init if decl's type + is error_mark_node. + 2016-12-02 Cesar Philippidis James Norris diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8b0a21cb2b2..b51e5801109 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14082,7 +14082,7 @@ tsubst_init (tree init, tree decl, tree args, init = tsubst_expr (init, args, complain, in_decl, false); - if (!init) + if (!init && TREE_TYPE (decl) != error_mark_node) { /* If we had an initializer but it instantiated to nothing, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 261731c54b0..103906be84e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-02 Jakub Jelinek + + PR c++/78649 + * g++.dg/cpp0x/pr78649.C: New test. + 2016-12-02 Uros Bizjak PR target/70322 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78649.C b/gcc/testsuite/g++.dg/cpp0x/pr78649.C new file mode 100644 index 00000000000..43bcb64f135 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr78649.C @@ -0,0 +1,16 @@ +// PR c++/78649 +// { dg-do compile { target c++11 } } + +template void foo (); +template +void +test () +{ + T t (foo...); // { dg-error "declared void" } +} + +int +main () +{ + test (); +}