From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 719F8385841C; Fri, 27 Aug 2021 17:44:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 719F8385841C From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/65174] noexcept() returns true when operator delete with a NULL PTR that has a throwing destructor Date: Fri, 27 Aug 2021 17:44: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: 4.9.2 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: cf_reconfirmed_on short_desc keywords 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: Fri, 27 Aug 2021 17:44:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D65174 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2018-10-17 00:00:00 |2021-8-27 Summary|noexcept() returns true |noexcept() returns true |when operator delete with |when operator delete with a |the object that has a |NULL PTR that has a |throwing destructor |throwing destructor Keywords| |wrong-code --- Comment #4 from Andrew Pinski --- Updated testcase to show that noexcept will also cause it to happen so it d= oes matter for C++17+ (where throw(std::bad_alloc) support has been removed): #include struct foo1 { ~foo1() noexcept(false) {} }; int main() { std::cout << std::boolalpha; std::cout << noexcept(delete static_cast(nullptr)) << std::endl; std::cout << noexcept(delete reinterpret_cast(0)) << std::endl; std::cout << noexcept(delete reinterpret_cast(1)) << std::endl; return 0; }=