I just found out that the following code is not a valid C++ (it doesn't parse at int
after ~
):
int x = 5;
x.~int();
However, the following snippet does work:
int32_t x = 5;
x.~int32_t();
This is because int32_t
is a typedef
in my particular implementation of C++, and a destructor can, apparently, be called on any typedef'ed type.
My question is: is any implementation of C++ required to allow the second snipped to compile? In particular, is int32_t
guaranteed to be a typedef, and is the compiler required to allow a destruction of a typedef if it knows that typedef typedefs something to int?