In The this pointer [class.this], the C++ standard states:
The type of
thisin a member function of a classXisX*.
i.e. this is not const. But why is it then that
struct M {
M() { this = new M; }
};
gives
error: invalid lvalue in assignment <-- gcc
'=' : left operand must be l-value <-- VC++
'=' : left operand must be l-value <-- clang++
'=' : left operand must be l-value <-- ICC
(source: some online compiler frontends)
In other words, this is not const, but it really is!