Message ID | 55AE6D16.6010509@oracle.com |
---|---|
State | New |
Headers | show |
On 07/21/2015 09:02 AM, Paolo Carlini wrote: > I had a look and tried various things... Ultimately the issue is due to > the type_was_error_mark_node becomes integer_type_node trick in > grokdeclarator (which I don't like that much ;) What happens if we just remove that trick? Jason
Hi, On 07/21/2015 06:07 PM, Jason Merrill wrote: > On 07/21/2015 09:02 AM, Paolo Carlini wrote: >> I had a look and tried various things... Ultimately the issue is due to >> the type_was_error_mark_node becomes integer_type_node trick in >> grokdeclarator (which I don't like that much ;) > What happens if we just remove that trick? Removing it completely (thus essentially unconditionally setting back type = error_mark_node when type_was_error_mark_node is true) leads to a few regressions. I tried that earlier today. For cases like other/nontype-1.C for example we do not handle the second error like the first one. Thus: nontype-1.C:3:16: error: ‘Op::first_argument_type’ is not a type nontype-1.C:4:16: error: ‘Op::second_argument_type’ is not a type becomes: nontype-1.C:3:16: error: ‘Op::first_argument_type’ is not a type nontype-1.C:3:37: error: expected ‘)’ before ‘,’ token nontype-1.C:3:37: error: expected ‘;’ before ‘,’ token In other case we get additional "no match for call"-type errors. In the case of cpp1y/pr65340.C we loose the error message about "use of 'auto' ... before deduction of 'auto'". All in all I think there are a few tricky cases: FAIL: g++.dg/cpp0x/alias-decl-33.C -std=c++11 (test for excess errors) FAIL: g++.dg/cpp0x/alias-decl-33.C -std=c++14 (test for excess errors) FAIL: g++.dg/cpp1y/pr65340.C -std=c++14 (test for errors, line 15) FAIL: g++.dg/cpp1y/pr65340.C -std=c++14 (test for excess errors) FAIL: g++.dg/inherit/error4.C -std=c++98 (test for errors, line 7) FAIL: g++.dg/inherit/error4.C -std=c++98 (test for excess errors) FAIL: g++.dg/inherit/error4.C -std=c++11 (test for errors, line 7) FAIL: g++.dg/inherit/error4.C -std=c++11 (test for excess errors) FAIL: g++.dg/inherit/error4.C -std=c++14 (test for errors, line 7) FAIL: g++.dg/inherit/error4.C -std=c++14 (test for excess errors) FAIL: g++.dg/other/nontype-1.C -std=c++98 (test for errors, line 4) FAIL: g++.dg/other/nontype-1.C -std=c++98 (test for excess errors) FAIL: g++.dg/other/nontype-1.C -std=c++11 (test for errors, line 4) FAIL: g++.dg/other/nontype-1.C -std=c++11 (test for excess errors) FAIL: g++.dg/other/nontype-1.C -std=c++14 (test for errors, line 4) FAIL: g++.dg/other/nontype-1.C -std=c++14 (test for excess errors) FAIL: g++.dg/parse/enum3.C -std=c++98 (test for errors, line 3) FAIL: g++.dg/parse/enum3.C -std=c++98 (test for excess errors) FAIL: g++.dg/parse/enum3.C -std=c++11 (test for errors, line 3) FAIL: g++.dg/parse/enum3.C -std=c++11 (test for excess errors) FAIL: g++.dg/parse/enum3.C -std=c++14 (test for errors, line 3) FAIL: g++.dg/parse/enum3.C -std=c++14 (test for excess errors) FAIL: g++.dg/parse/error3.C -std=gnu++98 (test for excess errors) FAIL: g++.dg/parse/error3.C -std=gnu++11 (test for excess errors) FAIL: g++.dg/parse/error3.C -std=gnu++14 (test for excess errors) FAIL: g++.dg/template/nontype25.C -std=c++98 (test for excess errors) FAIL: g++.dg/template/nontype25.C -std=c++11 (test for errors, line 10) FAIL: g++.dg/template/nontype25.C -std=c++14 (test for errors, line 10) What about applying something like my first patch with a comment that in principle we would like to extend it carefully to more cases outside template parameters? Thanks, Paolo.
On 07/21/2015 09:58 AM, Paolo Carlini wrote: > What about applying something like my first patch with a comment that in > principle we would like to extend it carefully to more cases outside > template parameters? OK, sure. Jason
Index: cp/decl.c =================================================================== --- cp/decl.c (revision 226028) +++ cp/decl.c (working copy) @@ -9315,7 +9315,10 @@ 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) + type = error_mark_node; + else + type = integer_type_node; } ctype = NULL_TREE; Index: testsuite/g++.dg/template/crash81.C =================================================================== --- testsuite/g++.dg/template/crash81.C (revision 226028) +++ testsuite/g++.dg/template/crash81.C (working copy) @@ -2,6 +2,5 @@ struct A { - template<T::X> struct X; // { dg-error "'T' has not been declared" "T" } - // { dg-bogus "declaration" "" { xfail *-*-* } 5 } + template<T::X> struct X; // { dg-error "'T' has not been declared" } };