From a3f7c896a55c33e369f9bbb210f4b43a345beabe Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 2 Dec 2016 22:23:22 +0100 Subject: [PATCH] =?utf8?q?re=20PR=20c++/78649=20(ICE=20on=20invalid=20C++?= =?utf8?q?=20code=20on=20x86=5F64-linux-gnu=20(internal=20compiler=20error?= =?utf8?q?:=20tree=20check:=20expected=20class=20=E2=80=98type=E2=80=99,?= =?utf8?q?=20have=20=E2=80=98exceptional=E2=80=99=20(error=5Fmark)=20in=20?= =?utf8?q?build=5Fvalue=5Finit=5Fnoctor,=20at=20cp/init.c:380))?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/pr78649.C | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr78649.C 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 (); +} -- 2.30.2