re PR c++/90173 (ICE: Segmentation fault (in strip_declarator_types))
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 26 Apr 2019 14:51:00 +0000 (14:51 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 26 Apr 2019 14:51:00 +0000 (14:51 +0000)
/cp
2019-04-26  Paolo Carlini  <paolo.carlini@oracle.com>

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  <paolo.carlini@oracle.com>

PR c++/90173
* g++.dg/cpp1z/class-deduction66.C: New.

From-SVN: r270603

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/class-deduction66.C [new file with mode: 0644]

index c78683d3949d1b7842d88726fab9c697fac04873..ab25cb94d3d6dcc84256627c15f6362d8444cf1b 100644 (file)
@@ -1,4 +1,11 @@
-2018-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
+2019-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       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  <paolo.carlini@oracle.com>
 
        * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
        min_location.
index 49ab387889608d56ccc1ce6295a62a0b934f3da3..ca21cbb9917d04b4609bb3900afb2cff6922558e 100644 (file)
@@ -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;
index 13416da786a533826d5b186e029b35362e82033a..2ada8268029460be3485448852894f920a420c33 100644 (file)
@@ -1,4 +1,9 @@
-2018-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
+2019-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/90173
+       * g++.dg/cpp1z/class-deduction66.C: New.
+
+2019-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * 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 (file)
index 0000000..7ed119d
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/90173
+// { dg-do run { target c++17 } }
+
+template <typename T> struct A { };
+
+A(int) -> A<int>;
+
+namespace decl {
+  A (*fp)() = 0;  // { dg-error "placeholder" }
+}