From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7953B385828E; Thu, 2 May 2024 07:35:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7953B385828E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714635330; bh=cheFtrfwgivq3Mrq6FJC9YHJ6fT8I9GbrNXRK0aZs6w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=w6pvBobGu8bE6mC+a6SHASBADMZhEAGVcrSbdZ48nr7zW/sPJmsc7Q/F6lONeB/DZ lfkVqxqUHsmxgSrskAWFoM4OokqrGG4WIxZW0ZkSO3u9OcnffcLh6FpYbErrfo/VUt 32zu7qUFFjqMBdvR0stQiLGN/qS/tLYaQlG/JNE0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114458] [C++26] P2573R2 - = delete("reason"); Date: Thu, 02 May 2024 07:35:29 +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: 14.0 X-Bugzilla-Keywords: diagnostic 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: jakub 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=3D114458 --- Comment #4 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:2f15787f2e1a3afe2c2ad93d4eb0d3c1f73c8fbd commit r15-105-g2f15787f2e1a3afe2c2ad93d4eb0d3c1f73c8fbd Author: Jakub Jelinek Date: Thu May 2 09:34:31 2024 +0200 c++: Implement C++26 P2573R2 - =3D delete("should have a reason"); [PR1= 14458] The following patch implements the C++26 P2573R2 =3D delete("should have a reason"); paper. I've tried to avoid increasing compile time memory for it when it isn't used (e.g. by adding a new lang_decl tree member), so the reason is represented as STRING_CST in DECL_INITIAL (which normally is for DECL_DELETED_FN error_mark_node) and to differentiate this delete("reas= on") initializer from some bogus attempt to initialize a function with "reas= on" using the RID_DELETE identifier as TREE_TYPE of the STRING_CST, as noth= ing needs to care about the type of the reason. If preferred it could be say TREE_LIST with the reason STRING_CST and RID_DELETE identifier or something similar instead, but that would need more compile time memory when it is used. 2024-05-02 Jakub Jelinek PR c++/114458 gcc/c-family/ * c-cppbuiltin.cc (c_cpp_builtins): Predefine __cpp_deleted_function=3D202403L for C++26. gcc/cp/ChangeLog * parser.cc (cp_parser_pure_specifier): Implement C++26 P2573R2 - =3D delete("should have a reason");. Parse deleted-function-= body. * decl.cc (duplicate_decls): Copy DECL_INITIAL from DECL_DELETE= D_FN olddecl to newdecl if it is a STRING_CST. (cp_finish_decl): Handle deleted init with a reason. * decl2.cc: Include "escaped_string.h". (grokfield): Handle deleted init with a reason. (mark_used): Emit DECL_DELETED_FN reason in the message if any. * cp-tree.h (DECL_DELETED_FN): Document representation of =3D delete("reason") on a DECL. gcc/testsuite/ * g++.dg/cpp26/feat-cxx26.C (__cpp_deleted_function): Add test. * g++.dg/cpp26/delete-reason1.C: New test. * g++.dg/cpp26/delete-reason2.C: New test. * g++.dg/parse/error65.C (f1): Adjust expected diagnostics.=