https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98441

--- Comment #4 from Daniel Santos <daniel.santos at pobox dot com> ---
Created attachment 49850
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49850&action=edit
Gentoo gcc 10.2.0-r2 patches

(In reply to Jonathan Wakely from comment #3)
> (In reply to Daniel Santos from comment #0)
> > However, it builds on GCC 9 and is alleged to build on MSVC.  The above
> > example is simplified from the original sources:
> 
> Are you sure this fails with 10.2.0? I only see it fail with 11.0 and not
> gcc version 10.2.1 20201125 (but I didn't try a newer build from the gcc-10
> branch).

Well, yes, but this is Gentoo gcc-10.2.0-r2, so includes a patchset (attached).
 In that, 34_all_fundecl-ICE-PR95820.patch contains the following:

It's an unofficial backport of PR95820 where gcc ICEs on
invalid syntax. As creduce frequently end up in these ICEs
as in #730406 let's backport it to gcc-10.

https://gcc.gnu.org/PR95820
https://bugs.gentoo.org/730406
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator,

            /* Handle a late-specified return type.  */
            tree late_return_type = declarator->u.function.late_return_type;
-           if (funcdecl_p
-               /* This is the case e.g. for
-                  using T = auto () -> int.  */
-               || inner_declarator == NULL)
+           if (true)
              {
                if (tree auto_node = type_uses_auto (type))
                  {
-                   if (!late_return_type)
+                   if (!late_return_type && funcdecl_p)
                      {
                        if (current_class_type
                            && LAMBDA_TYPE_P (current_class_type))

Reply via email to