From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 949703858C2D; Tue, 11 Apr 2023 16:39:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 949703858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681231190; bh=2gFOcXjxq/SBCv7KE01SXvDcI5vR35lA+1wfXl3dEPY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EO+TKtudY+nn4kpm4MY9V/lcRxNDZyNQnxHWkj9F2ZPI4GGfeNwL4p+wHdSviCFzp OxIFCJPtK+7v28k0x/4tmGzPHHvuaaStxnJ2B5J0p3VkYTDxrYQYjygPDSU5NgKGIo r7RX1wyohBDidsm8f+qbsyId14GKN+Q0sp+1eh8o= From: "acoplan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60512] would be useful if gcc implemented __has_feature similary to clang Date: Tue, 11 Apr 2023 16:39:48 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: acoplan at gcc dot gnu.org X-Bugzilla-Status: NEW 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=3D60512 --- Comment #13 from Alex Coplan --- Clang recognizes the "cxx_defaulted_functions" feature to detect whether "= =3D default" functions are supported. It's clear that __has_feature (cxx_defaulted_functions) should evaluate to 1 for -std=3Dc++11 and above. It's less clear whether GCC intends to support = "=3D default" functions in C++98 mode as an extension, and therefore whether __has_extension (cxx_defaulted_functions) should evaluate to 1 with -std=3D= c++98. I noticed that e.g. we accept: struct S { int x; S(int a) : x(a) {} S() =3D default; }; void f() { S s; } with -std=3Dc++98 and emit a -Wc++11-extensions warning. This suggests that= "=3D default" might be supported as an extension, but it's not clear. By contras= t, it seems that deleted functions (detected with "cxx_deleted_functions") are= n't supported in C++98 mode, since e.g. struct S { S() =3D delete; }; void f() { S s; } doesn't get rejected with -std=3Dc++98. It would be good to get some input = from C++ maintainers on the cxx_defaulted_functions case.=