from N4618 5.2.9 [expr.static.cast] p2
> An lvalue of type "cv1 B", where B is a class type, can be cast to type
> "reference to cv2 D", where D is a class derived (Clause 10) from B, if
> cv2 is the same cv-qualification as, or greater cv-qualification than,
> cv1. If B is a virtual base class of D or a base class of a virtual base
> class of D, or if no valid standard conversion from "pointer to D" to
> "pointer to B" exists (4.11), the program is ill-formed. An xvalue of
> type "cv1 B" can be cast to type "rvalue reference to cv2 D" with the
> same constraints as for an lvalue of type "cv1 B". *If the object of
> type "cv1 B" is actually a subobject of an object of type D, the result
> refers to the enclosing object of type D.* Otherwise, the behavior is
> undefined.
Note that "If the object ... is actually a subobject ..." does not
qualify as "a base class subobject". Without qualifying as "base class
subobject", I think the above wording mandates impossible conversions
like this:
struct B {};
struct D : B { B b; };
D d;
B& rb = d.b; // Since the object referred by rb is actually a subobject of d,
D& rd = static_cast<D&>(rb); // rd must refer the enclosing d.
But of course, it doesn't work.
http://melpon.org/wandbox/permlink/VOVaW96txf57Zow6
I propose to replace "a subobject" to "a base class subobject".
https://github.com/k-satoda/cplusplus-draft/commit/753f87e351af03afb5389a5cbb4c024193d9040b
Is this need a core issue?
I think the intent is clear, so it is possible to see this as an
editorial fix (to fix it quickly via a pull request as is).
--
k_satoda