const MyClass(int x, y) : _offset = Offset(x,y);
Does not work because the call context is not currently propagated into the constructor body.
Creating MyClass with const
is different than creating it with new
, but we can't pass that to Offset
.
Putting const
before Offset
is invalid in the new
context, and having (implicit) new
is invalid in const
context.
This might be changed in the future, and I saw there a quite a number of tickets with the tag enhanced-const
.
The intuitive behaviour would be that Offset
is const when MyClass
is const.