[Bug c++/65174] noexcept() returns true when operator delete with the object that has a throwing destructor

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 23 15:39:00 GMT 2015


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
FWIW clang and EDG both fail the first two static assertions here, while GCC
passes all three:

struct foo {
    ~foo() throw(int) {}
};

int main() {
    static_assert( noexcept(delete static_cast<foo*>(nullptr)), "");
    static_assert( noexcept(delete static_cast<foo*>(0)), "");
    static_assert( !noexcept(delete (1+static_cast<foo*>(0))), "");
}



More information about the Gcc-bugs mailing list