From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 78EFF386196F; Tue, 14 Jul 2020 13:42:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78EFF386196F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594734129; bh=Jc1PJAt1upUwUozzrEsKPnd6BYSddT9DvnGOjvwSF2I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Mkqxm3PRQVyckNFsggiqVH1s0CJjE6MFbiIIvAUpQv2JqXz1NMGcsem6rNJU2FmNE CaQKCzg8W4Xawn6noEGcL7qvBHOgU9575SOLuiK2WkvFGB4mp3vHgIGPMXbS0pwLyl nlDigmIZ0RCATMrgYXVmok/SyFVmXkUm+SMOIsm8= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95820] [10/11 Regression] ICE in splice_late_return_type, at cp/pt.c:29034 Date: Tue, 14 Jul 2020 13:42:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2020 13:42:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95820 --- Comment #6 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:9eb370f19c1198e62d47eae74531e54d0b098bf1 commit r11-2085-g9eb370f19c1198e62d47eae74531e54d0b098bf1 Author: Marek Polacek Date: Wed Jun 24 17:39:21 2020 -0400 c++: Improve checking of decls with trailing return type [PR95820] This is an ICE-on-invalid but I've been seeing it when reducing various testcases, so it's more important for me than usually. splice_late_return_type now checks that if we've seen a late return type, the function return type was auto. That's a fair assumption but grokdeclarator/cdk_function wasn't giving errors for function pointers and similar. So we want to perform various checks not only when funcdecl_p || inner_declarator =3D=3D NULL. But only give the !late_return_type errors when funcdecl_p, to accept e.g. auto (*fp)() =3D f; in C++11. Here's a diff -w to ease the review: --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12102,14 +12102,9 @@ grokdeclarator (const cp_declarator *declarato= r, /* Handle a late-specified return type. */ tree late_return_type =3D declarator->u.function.late_return_type; - if (funcdecl_p - /* This is the case e.g. for - using T =3D auto () -> int. */ - || inner_declarator =3D=3D NULL) - { if (tree auto_node =3D type_uses_auto (type)) { - if (!late_return_type) + if (!late_return_type && funcdecl_p) { if (current_class_type && LAMBDA_TYPE_P (current_class_type)) @@ -12201,7 +12196,6 @@ grokdeclarator (const cp_declarator *declarator, "type specifier", name); return error_mark_node; } - } type =3D splice_late_return_type (type, late_return_type); if (type =3D=3D error_mark_node) return error_mark_node; gcc/cp/ChangeLog: PR c++/95820 * decl.c (grokdeclarator) : Check also pointers/references/... to functions. gcc/testsuite/ChangeLog: PR c++/95820 * g++.dg/cpp1y/auto-fn58.C: New test.=