Message ID | 20181126204931.GI12380@tucnak |
---|---|
State | New |
Headers | show |
Series | [C++] Fix ICE in grokdeclarator (PR c++/88187) | expand |
On 11/26/18 3:49 PM, Jakub Jelinek wrote: > Hi! > > Marek has changed grokdeclarator in r263836, so that in this part of code > it is either a funcdecl_p (previously the only allowed one), which > implies inner_declarator is non-NULL and therefore unqualified_id too, > or newly inner_declarator == NULL. In that case, we IMHO shouldn't be > testing for the deduction guides errors and let it be rejected as before > later. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2018-11-26 Jakub Jelinek <jakub@redhat.com> > > PR c++/88187 > * decl.c (grokdeclarator): Don't diagnose deduction guide errors > if inner_declarator is NULL. > > * g++.dg/other/pr88187.C: New test. > > --- gcc/cp/decl.c.jj 2018-11-17 00:16:41.000000000 +0100 > +++ gcc/cp/decl.c 2018-11-26 11:18:30.518620651 +0100 > @@ -11276,7 +11276,7 @@ grokdeclarator (const cp_declarator *dec > if (!tmpl) > if (tree late_auto = type_uses_auto (late_return_type)) > tmpl = CLASS_PLACEHOLDER_TEMPLATE (late_auto); > - if (tmpl) > + if (tmpl && inner_declarator) Let's check funcdecl_p rather than inner_declarator. OK with that change. Jason
--- gcc/cp/decl.c.jj 2018-11-17 00:16:41.000000000 +0100 +++ gcc/cp/decl.c 2018-11-26 11:18:30.518620651 +0100 @@ -11276,7 +11276,7 @@ grokdeclarator (const cp_declarator *dec if (!tmpl) if (tree late_auto = type_uses_auto (late_return_type)) tmpl = CLASS_PLACEHOLDER_TEMPLATE (late_auto); - if (tmpl) + if (tmpl && inner_declarator) { if (!dguide_name_p (unqualified_id)) { --- gcc/testsuite/g++.dg/other/pr88187.C.jj 2018-11-26 11:29:46.096459145 +0100 +++ gcc/testsuite/g++.dg/other/pr88187.C 2018-11-26 11:30:58.110269662 +0100 @@ -0,0 +1,7 @@ +// PR c++/88187 +// { dg-do compile } + +template <int> struct A; +void f (A ()); // { dg-error "variable or field 'f' declared void" "" { target c++14_down } } + // { dg-error "missing template arguments before '\\(' token" "" { target c++14_down } .-1 } + // { dg-error "'auto' parameter not permitted in this context" "" { target c++17 } .-2 }