On 11/09/2020 04:56, jim x wrote:
> The standard rule does not say that, so `ri` does not gurant to refer to
> the new subobject, because the rule only says:
>> a new object is created at the storage location which the original object
> occupied, a pointer that pointed to the original object, a reference that
> referred to the original object, or the name of the original object will
> automatically refer to the new object.
>
> please note the wording `new object` and `original object`. In your
> example, you created a new object of type `S`
I create 2 new objects. Of type `S` and of type `int`.
> while you possess a reference
> that referred to the subobject of the original object. which violate these
> rules:
>> the storage that o2 occupies exactly overlays the storage that o1occupied,
> and.
>> o1 and o2 are of the same type (ignoring the top-level cv-qualifiers)
>
> So, anyhow, Your example is not covered by these rules.
It is covered by [basic.life]/(8.5)