From 69dad6faf9f00b0b22a822f0a0bcc57e7256959e Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 26 Apr 2019 14:51:00 +0000 Subject: [PATCH] re PR c++/90173 (ICE: Segmentation fault (in strip_declarator_types)) /cp 2019-04-26 Paolo Carlini PR c++/90173 * decl.c (grokdeclarator): Set type to error_mark_node upon error about template placeholder type non followed by a simple declarator-id. /testsuite 2019-04-26 Paolo Carlini PR c++/90173 * g++.dg/cpp1z/class-deduction66.C: New. From-SVN: r270603 --- gcc/cp/ChangeLog | 9 ++++++++- gcc/cp/decl.c | 1 + gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/g++.dg/cpp1z/class-deduction66.C | 10 ++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction66.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c78683d3949..ab25cb94d3d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,4 +1,11 @@ -2018-04-26 Paolo Carlini +2019-04-26 Paolo Carlini + + PR c++/90173 + * decl.c (grokdeclarator): Set type to error_mark_node + upon error about template placeholder type non followed + by a simple declarator-id. + +2019-04-26 Paolo Carlini * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use min_location. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 49ab3878896..ca21cbb9917 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10973,6 +10973,7 @@ grokdeclarator (const cp_declarator *declarator, error_at (typespec_loc, "template placeholder type %qT must be followed " "by a simple declarator-id", type); inform (DECL_SOURCE_LOCATION (tmpl), "%qD declared here", tmpl); + type = error_mark_node; } staticp = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13416da786a..2ada8268029 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ -2018-04-26 Paolo Carlini +2019-04-26 Paolo Carlini + + PR c++/90173 + * g++.dg/cpp1z/class-deduction66.C: New. + +2019-04-26 Paolo Carlini * g++.dg/diagnostic/trailing1.C: New. diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction66.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction66.C new file mode 100644 index 00000000000..7ed119d1cdd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction66.C @@ -0,0 +1,10 @@ +// PR c++/90173 +// { dg-do run { target c++17 } } + +template struct A { }; + +A(int) -> A; + +namespace decl { + A (*fp)() = 0; // { dg-error "placeholder" } +} -- 2.30.2