[conv.mem] # 7 Expressions [[expr]](./#expr) ## 7.3 Standard conversions [[conv]](conv#mem) ### 7.3.13 Pointer-to-member conversions [conv.mem] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L1075) A [null pointer constant](conv.ptr#def:constant,null_pointer "7.3.12 Pointer conversions [conv.ptr]") can be converted to a pointer-to-member type; the result is the [*null member pointer value*](#def:value,null_member_pointer "7.3.13 Pointer-to-member conversions [conv.mem]") of that type and is distinguishable from any pointer to member not created from a null pointer constant[.](#1.sentence-1) Such a conversion is called a [*null member pointer conversion*](#def:conversion,null_member_pointer "7.3.13 Pointer-to-member conversions [conv.mem]")[.](#1.sentence-2) The conversion of a null pointer constant to a pointer to member of cv-qualified type is a single conversion, and not the sequence of a pointer-to-member conversion followed by a qualification conversion ([[conv.qual]](conv.qual "7.3.6 Qualification conversions"))[.](#1.sentence-3) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L1090) A prvalue of type “pointer to member of B of type cvT”, where B is a class type, can be converted to a prvalue of type “pointer to member of D of type cvT”, where D is a complete class derived ([[class.derived]](class.derived "11.7 Derived classes")) from B[.](#2.sentence-1) If B is an inaccessible ([[class.access]](class.access "11.8 Member access control")), ambiguous ([[class.member.lookup]](class.member.lookup "6.5.2 Member name lookup")), or virtual ([[class.mi]](class.mi "11.7.2 Multiple base classes")) base class of D, or a base class of a virtual base class ofD, a program that necessitates this conversion is ill-formed[.](#2.sentence-2) If class D does not contain the original member and is not a base class of the class containing the original member, the behavior is undefined[.](#2.sentence-3) Otherwise, the result of the conversion refers to the same member as the pointer to member before the conversion took place, but it refers to the base class member as if it were a member of the derived class[.](#2.sentence-4) The result refers to the member in D's instance of B[.](#2.sentence-5) Since the result has type “pointer to member of D of type cv T”, indirection through it with a D object is valid[.](#2.sentence-6) The result is the same as if indirecting through the pointer to member of B with theB subobject of D[.](#2.sentence-7) The null member pointer value is converted to the null member pointer value of the destination type[.](#2.sentence-8)[46](#footnote-46 "The rule for conversion of pointers to members (from pointer to member of base to pointer to member of derived) appears inverted compared to the rule for pointers to objects (from pointer to derived to pointer to base) ([conv.ptr], [class.derived]). This inversion is necessary to ensure type safety. Note that a pointer to member is not an object pointer or a function pointer and the rules for conversions of such pointers do not apply to pointers to members. In particular, a pointer to member cannot be converted to a void*.") [46)](#footnote-46)[46)](#footnoteref-46) The rule for conversion of pointers to members (from pointer to member of base to pointer to member of derived) appears inverted compared to the rule for pointers to objects (from pointer to derived to pointer to base) ([[conv.ptr]](conv.ptr "7.3.12 Pointer conversions"), [[class.derived]](class.derived "11.7 Derived classes"))[.](#footnote-46.sentence-1) This inversion is necessary to ensure type safety[.](#footnote-46.sentence-2) Note that a pointer to member is not an object pointer or a function pointer and the rules for conversions of such pointers do not apply to pointers to members[.](#footnote-46.sentence-3) In particular, a pointer to member cannot be converted to avoid*[.](#footnote-46.sentence-4)