From faa16e44059217584127bb0d825b27b1d263a894 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 21 Jul 2015 20:51:28 +0000 Subject: [PATCH] decl.c (grokdeclarator): For an erroneous template parameter propagate error_mark_node as type. /cp 2015-07-21 Paolo Carlini * decl.c (grokdeclarator): For an erroneous template parameter propagate error_mark_node as type. /testsuite 2015-07-21 Paolo Carlini * g++.dg/template/crash81.C: Update. From-SVN: r226054 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 7 ++++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/template/crash81.C | 3 +-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b72b22f5ef8..bb0385d8b17 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-07-21 Paolo Carlini + + * decl.c (grokdeclarator): For an erroneous template parameter + propagate error_mark_node as type. + 2015-07-20 Marek Polacek PR c++/55095 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index db8b1aa17ca..01b81200596 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9315,7 +9315,12 @@ grokdeclarator (const cp_declarator *declarator, warning (OPT_Wreturn_type, "ISO C++ forbids declaration of %qs with no type", name); - type = integer_type_node; + if (type_was_error_mark_node && template_parm_flag) + /* FIXME we should be able to propagate the error_mark_node as is + for other contexts too. */ + type = error_mark_node; + else + type = integer_type_node; } ctype = NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 16d1caf0638..749b04fa3bd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-21 Paolo Carlini + + * g++.dg/template/crash81.C: Update. + 2015-07-21 Vladimir Makarov PR ipa/66424. diff --git a/gcc/testsuite/g++.dg/template/crash81.C b/gcc/testsuite/g++.dg/template/crash81.C index 54efba65aa9..c0ea37f1c62 100644 --- a/gcc/testsuite/g++.dg/template/crash81.C +++ b/gcc/testsuite/g++.dg/template/crash81.C @@ -2,6 +2,5 @@ struct A { - template struct X; // { dg-error "'T' has not been declared" "T" } - // { dg-bogus "declaration" "" { xfail *-*-* } 5 } + template struct X; // { dg-error "'T' has not been declared" } }; -- 2.30.2