Date: Sat, 28 Aug 2021 09:49:25 -0400
On Sat, Aug 28, 2021 at 6:11 AM Vladimir Grigoriev via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> This phrase in the paragraph #4 of the section «Construction and destruction»
>
> «If the virtual function call uses an explicit class member access (7.6.1.4) and the object expression refers to the complete object of x or one of that object’s base class subobjects but not x or one of its base class subobjects, the behavior is undefined.»
>
> What is the difference between the complete object of x or one of that object’s base class subobjects and the x or one of its base class subobjects?
The term "complete object" is defined in [intro.object]. It is an
object which is not a subobject of another object.
`x` is the object being constructed, and it may be the subobject of
another object. Thus, the "complete object of x" is the complete
object in which `x` is a subobject, or just `x` if `x` is not a
subobject.
Basically, what the text is saying is that if you try to use explicit
member access to call a virtual function that goes *outside* of the
inheritance graph of `x`, you get UB.
<std-discussion_at_[hidden]> wrote:
>
> This phrase in the paragraph #4 of the section «Construction and destruction»
>
> «If the virtual function call uses an explicit class member access (7.6.1.4) and the object expression refers to the complete object of x or one of that object’s base class subobjects but not x or one of its base class subobjects, the behavior is undefined.»
>
> What is the difference between the complete object of x or one of that object’s base class subobjects and the x or one of its base class subobjects?
The term "complete object" is defined in [intro.object]. It is an
object which is not a subobject of another object.
`x` is the object being constructed, and it may be the subobject of
another object. Thus, the "complete object of x" is the complete
object in which `x` is a subobject, or just `x` if `x` is not a
subobject.
Basically, what the text is saying is that if you try to use explicit
member access to call a virtual function that goes *outside* of the
inheritance graph of `x`, you get UB.
Received on 2021-08-28 08:49:56