-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Bug
Copy link
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
When a destroying delete function is called, the pointed-to object's destructor is not run --- it is the responsibility of the destroying delete function to run any destructors. However, when querying the noexcept operator for such a delete expression, Clang is considering the exception specification of the destructor, even though at runtime it clearly performs the right code.
#include <cstdio>
#include <new>
struct Explicit {
~Explicit() noexcept(false) { puts("should not be called");}
void operator delete(Explicit*, std::destroying_delete_t) noexcept {
std::puts("destroyed explicit");
}
};
// #define SHOW_BUGS
#if defined(SHOW_BUGS)
Explicit * qn = nullptr;
static_assert( noexcept(delete(qn)));
#endif
int main() {
Explicit *q = new Explicit();
delete q;
}
Here us a Compiler Explorer link to a more complete test, that passed on EDG even with the SHOW_BUGS macro defined:
https://godbolt.org/z/YaaeT8W17
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"