From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F17643857B9B; Sun, 16 Oct 2022 15:47:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F17643857B9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665935248; bh=InkqRoqWASwmqH4nMhZUgLvRs1xQxEH1Rl9vDz+AlXk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fmXEV1g5ouMgh0iy5cLwwTUudFnbu/4WJ25rjH/i16v7JQSjKHHoGcY5JCBSKXs2N 9gHF1kOTk0GuxbEX9sNXy/6lsfyrX887UzcrJ5rsWhJeTpvAsKr8m2BT0BKOqiHqwM pWSkafb5TOsV+MZghwnZIBrQMMUULWyDl7Zvq4sU= From: "ky4ct at arrl dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107278] fails to correctly parse template default function declarations. Date: Sun, 16 Oct 2022 15:47:25 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ky4ct at arrl dot net X-Bugzilla-Status: CLOSED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107278 Jonathan changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #8 from Jonathan --- Proposed resolution (November, 2017) Change 11.4.5 [class.ctor] paragraph 1 as follows: ...and the id-expression has one of the following forms: in a member-declaration that belongs to the member-specificatio= n of a class or class template but is not a friend declaration (11.8.4 [class.friend]), the id-expression is the injected-class-name ( Clause 11 [class]) of the immediately-enclosing class; entity or in a member-declaration that belongs to the member-specificatio= n of a class template but is not a friend declaration, the id-expression is a class-name that names the current instantiation (13.8.3.2 [temp.dep.type]) = of the immediately-enclosing class template; or in a declaration at namespace scope or in a friend declaration,= the id-expression is a qualified-id that names a constructor (6.5.5.2 [class.qual]). Change 11.4.7 [class.dtor] paragraph 1 as follows: ...and the id-expression has one of the following forms: in a member-declaration that belongs to the member-specificatio= n of a class or class template but is not a friend declaration (11.8.4 [class.friend]), the id-expression is ~class-name and the class-name is the injected-class-name (Clause 11 [class]) of the immediately-enclosing class; entity or in a member-declaration that belongs to the member-specificatio= n of a class template but is not a friend declaration, the id-expression is ~class-name and the class-name names the current instantiation (13.8.3.2 [temp.dep.type]) of the immediately-enclosing class template; or in a declaration at namespace scope or in a friend declaration,= the id-expression is nested-name-specifier ~class-name and the class-name names= the same class as the nested-name-specifier. Add the following as a new paragraph in C.2 [diff.cpp17]: C.5.x Clause 15: Special member functions [diff.cpp17.special] Affected subclauses: 11.4.5 [class.ctor], 11.4.7 [class.dtor] Change: A simple-template-id is no longer valid as the declarator-i= d of a constructor or destructor. Rationale: Remove potentially error-prone option for redundancy. Effect on original feature: Valid C++ 2017 code may fail to compile. template struct A { A(); // error: simple-template-id not allowed for construct= or A(int); // OK, injected-class-name used ~A(); // error: simple-template-id not allowed for destructor }; (Note that this resolution is a change for C++20, NOT a defect report again= st C++17 and earlier versions.)=