A pseudo-destructor is a destructor-like syntax called in a non-classical type:
typedef int I; I x; xI::~I();
If it was parsed βnaively,β then the parser will see the following tokens:
unqualified-id ( x ), typename ( I ), :: , bitwise-negate, typename ( I ), ( , ) ,; .
Bitwise negation is a problem because if you just wrote this:
~I();
Then it would form a valid expression with different semantics. Namely, the same as ~0 . Therefore, the expression above must be analyzed differently in order to take into account the context of the pseudo-destructor.
source share