Why doesn't this code produce a compiler error:
class C
{
int _i{ 123 };
int* ptr{ &_i };
public:
int& i() const { return *ptr; }
};
int main()
{
C const c;
c.i() += 321;
return c.i();
}
Is there some words in the standard about this behavior? Of course, maybe there is no point to point to members which can be access directly anyway, but what about owning resources on the heap that can be regarded as part of the object too.