Re: [C++ Patch] PR 90173 ("[9 Regression] ICE: Segmentation fault (in strip_declarator_types)")

2019-04-27 Thread Jakub Jelinek
On Tue, Apr 23, 2019 at 05:25:28PM +0200, Paolo Carlini wrote:
> /testsuite
> 2019-04-23  Paolo Carlini  
> 
>   PR c++/90173
>   * g++.dg/cpp1z/class-deduction66.C: New.

The test fails everywhere if check-c++-all with:
+UNRESOLVED: g++.dg/cpp1z/class-deduction66.C  -std=c++17 compilation failed to 
produce executable
+UNRESOLVED: g++.dg/cpp1z/class-deduction66.C  -std=c++2a compilation failed to 
produce executable

Fixed thusly (the test doesn't have main and has dg-error), regtested on 
x86_64-linux,
committed to trunk as obvious:

2019-04-27  Jakub Jelinek  

PR c++/90173
* g++.dg/cpp1z/class-deduction66.C: Use dg-do compile instead of
dg-do run.

--- gcc/testsuite/g++.dg/cpp1z/class-deduction66.C.jj   2019-04-26 
17:37:45.17111 +0200
+++ gcc/testsuite/g++.dg/cpp1z/class-deduction66.C  2019-04-27 
23:54:33.941071012 +0200
@@ -1,5 +1,5 @@
 // PR c++/90173
-// { dg-do run { target c++17 } }
+// { dg-do compile { target c++17 } }
 
 template  struct A { };
 

Jakub


Re: [C++ Patch] PR 90173 ("[9 Regression] ICE: Segmentation fault (in strip_declarator_types)")

2019-04-26 Thread Jason Merrill

On 4/25/19 7:14 PM, Paolo Carlini wrote:

Hi,

On 25/04/19 23:14, Jason Merrill wrote:
On Tue, Apr 23, 2019 at 11:26 AM Paolo Carlini 
 wrote:

I tried a few different things to avoid this simple error-recovery
regression but, all in all, I think it makes sense to simply bail out
early from grokdeclarator upon the first error. Tested x86_64-linux.

"type = error_mark_node" doesn't work?


Yes, it passes testing and appears to work fine: in practice for the new 
testcase grokdeclarator doesn't issue any further diagnostic and returns 
error_mark_node a few lines below, around line # 11256. Shall we apply 
this version to gcc-9-branch too?


When the branch reopens, yes.

Jason



Re: [C++ Patch] PR 90173 ("[9 Regression] ICE: Segmentation fault (in strip_declarator_types)")

2019-04-25 Thread Paolo Carlini

Hi,

On 25/04/19 23:14, Jason Merrill wrote:

On Tue, Apr 23, 2019 at 11:26 AM Paolo Carlini  wrote:

I tried a few different things to avoid this simple error-recovery
regression but, all in all, I think it makes sense to simply bail out
early from grokdeclarator upon the first error. Tested x86_64-linux.

"type = error_mark_node" doesn't work?


Yes, it passes testing and appears to work fine: in practice for the new 
testcase grokdeclarator doesn't issue any further diagnostic and returns 
error_mark_node a few lines below, around line # 11256. Shall we apply 
this version to gcc-9-branch too?


Thanks! Paolo.



Re: [C++ Patch] PR 90173 ("[9 Regression] ICE: Segmentation fault (in strip_declarator_types)")

2019-04-25 Thread Jason Merrill
On Tue, Apr 23, 2019 at 11:26 AM Paolo Carlini  wrote:
>
> I tried a few different things to avoid this simple error-recovery
> regression but, all in all, I think it makes sense to simply bail out
> early from grokdeclarator upon the first error. Tested x86_64-linux.

"type = error_mark_node" doesn't work?

Jason


[C++ Patch] PR 90173 ("[9 Regression] ICE: Segmentation fault (in strip_declarator_types)")

2019-04-23 Thread Paolo Carlini

Hi,

I tried a few different things to avoid this simple error-recovery 
regression but, all in all, I think it makes sense to simply bail out 
early from grokdeclarator upon the first error. Tested x86_64-linux.


Thanks, Paolo.

///

/cp
2019-04-23  Paolo Carlini  

PR c++/90173
* decl.c (grokdeclarator): Early return error_mark_node
upon error about template placeholder type non followed
by a simple declarator-id.

/testsuite
2019-04-23  Paolo Carlini  

PR c++/90173
* g++.dg/cpp1z/class-deduction66.C: New.
Index: cp/decl.c
===
--- cp/decl.c   (revision 270500)
+++ cp/decl.c   (working copy)
@@ -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);
+  return error_mark_node;
 }
 
   staticp = 0;
Index: testsuite/g++.dg/cpp1z/class-deduction66.C
===
--- testsuite/g++.dg/cpp1z/class-deduction66.C  (nonexistent)
+++ testsuite/g++.dg/cpp1z/class-deduction66.C  (working copy)
@@ -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" }
+}