Closed xmh0511 closed 1 year ago
Member addresses are increasing in declaration order, so X::a
comes before X::b
.
In your example, we can just ignore "X" and say that a plain "int" was created in the allocated storage, and your program has defined behavior. What's the problem?
Member addresses are increasing in declaration order, so
X::a
comes beforeX::b
.
However, we didn't access X::a
, and even though X::a
comes before X::b
, we do not say it is forbidden in the current standard.
I think your (absurd) interpretation is indistinguishable from mine, where there is simply an int
object created in the storage.
Again, where is the problem?
Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this example:
I say
ptr
points to the subobjectX::b
, and in the example, it can be well-defined as per [intro.object] p11Consider
X::b
is located at the address of the start of the region and access to the subobject is well-defined. Because we do not impose the complete object should be within the region ifX::b
is within the region.