Closed
Description
I might have found an issue with the order of destructor call of a temporary and the call to the __cxa_throw
function within a throw
statement.
In the following code, the Clang frontend first calls __cxa_throw
and afterwards a::~a
. See https://godbolt.org/z/jbx74s1Ge
struct a {
~a() noexcept;
};
struct b {
b(a) noexcept;
};
void c() {throw b(a()); }
GCC generates it in opposite order which is more logical to me. ICC generates it in the same order as Clang. I don't know what is correct from the C++ standard, maybe it is undefined.