C++ Stack Semantics for Reference Types oddity
In the MSDN article on "C++ Stack Semantics for Reference Types" it says that:
"A compiler-generated assignment operator will follow the usual standard C++ rules with the following additions:
*
Any non-static data members whose type is a handle to a reference type will be shallow copied (treated like a non-static data member whose type is a pointer).
*
Any non-static data member whose type is a value type will be shallow copied.
*
Any non-static data member whose type is an instance of a reference type will invoke a call to the reference type’s copy-constructor."
Regarding the last item:
1) First it implies that a CLR reference type can be a non-static data member of a native C++ class since, unless I am mistaken, a compiler-generated assignment operator never occurs for CLR classes. Yet elsewhere I also read that a native C++ class having a member that is a ref class type is ill-formed.
2) Secondly, given that 1) is allowable I would have intuited that the assignment operator for the instance of the reference type would calll the user-defined assignment operator for the reference type and not the user-defined copy constructor for the reference type.
It seems I am misreading badly something in this topic, even though I understand what C++ stack semantics for reference types are about, or else the explanation above is badly mangled. I hope somebody can straighten me out on the wording above.