https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65174

Andrew Pinski <pinskia at gcc dot gnu.org> 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 <pinskia at gcc dot gnu.org> ---
Updated testcase to show that noexcept will also cause it to happen so it does
matter for C++17+ (where throw(std::bad_alloc) support has been removed):
#include <iostream>

struct foo1 {
    ~foo1() noexcept(false) {}
};

int main() {
    std::cout << std::boolalpha;
    std::cout << noexcept(delete static_cast<foo1*>(nullptr)) << std::endl;
    std::cout << noexcept(delete reinterpret_cast<foo1*>(0)) << std::endl;
    std::cout << noexcept(delete reinterpret_cast<foo1*>(1)) << std::endl;
    return 0;
}

Reply via email to