You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Member functions, including virtual functions ([class.virtual]), can be called during construction or destruction ([class.base.init]). When a virtual function is called directly or indirectly from a constructor or from a destructor, including during the construction or destruction of the class's non-static data members, and the object to which the call applies is the object (call it x) under construction or destruction, the function called is the final overrider in the constructor's or destructor's class and not one overriding it in a more-derived class. If the virtual function call uses an explicit class member access ([expr.ref]) 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.
The definition of obj causes the invocation of B::B(), which in turn causes the invocation of A::A(B*). These two objects are both under construction(their constructors are both being called at that point). Obviously, this is not the intent of how to interpret "under construction or destruction" in the original provisions. The construction or destruction of a base class can be within the construction or destruction of a derived class, this causes the issue: which one is referred to by "under construction or destruction"?
I think we should change "the object under construction or destruction" to
the object under nearest construction or destruction; "nearest" means the object's constructor or destructor was most recently entered and not yet exited.
The proposal more conforms to the interpretation exposed by the formal examples. In addition, [class.cdtor] p5 and p6 also have this issue.
The text was updated successfully, but these errors were encountered:
[class.cdtor] p4 says
Consider this example
The definition of
obj
causes the invocation ofB::B()
, which in turn causes the invocation ofA::A(B*)
. These two objects are both under construction(their constructors are both being called at that point). Obviously, this is not the intent of how to interpret "under construction or destruction" in the original provisions. The construction or destruction of a base class can be within the construction or destruction of a derived class, this causes the issue: which one is referred to by "under construction or destruction"?I think we should change "the object under construction or destruction" to
The proposal more conforms to the interpretation exposed by the formal examples. In addition, [class.cdtor] p5 and p6 also have this issue.
The text was updated successfully, but these errors were encountered: