From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CED513858438; Mon, 3 Oct 2022 09:51:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CED513858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664790692; bh=0xn6J+pALjmF9mP7QQU3XCLzOnLzaKH7/Iu0dLUWyhA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j8TnoQ+F7AahGIMigRGVZuXs2vGxRCSc3lkDVFfjmgZyxe46e4Rb6milTXb76oD8j jkOWWVH9gM/JC2KGSmscL+IapsID5XeUhM/JljXMsGlocTfSPOmvVpB6Ne1uQ3CMQz YQZuZRzeTxU97t2MljlJUIolaAHR/5WSxgz2qiwg= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107126] GCC accepts invalid out of class definition for destructor with C++17 Date: Mon, 03 Oct 2022 09:51:31 +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.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: 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=3D107126 --- Comment #7 from Jonathan Wakely --- https://wg21.link/cwg1435 introduced the wording that allows this (which can still be seen in the context for the [class.dtor] changes in CWG 2337): "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." https://wg21.link/p1787r6 changed that to: "otherwise, the id-expression is nested-name-specifier ~class-name and the class-name is the injected-class-name of the class nominated by the nested-name-specifier." This seems like a breaking change that was not obvious from the revision history of the r5 paper: - Required destructor declarations to use the injected-class-name, avoiding name lookup - Simplified lookup for destructors - Specified that < begins a template argument list in a destructor name All compilers accept the program in C++17 mode, and I don't think it's at a= ll clear that the code was always invalid in older standards, as you claim.=