|
1020 | 1020 | ambiguous\iref{class.member.lookup}, or virtual\iref{class.mi} base |
1021 | 1021 | class of \tcode{D}, or a base class of a virtual base class of |
1022 | 1022 | \tcode{D}, a program that necessitates this conversion is ill-formed. |
1023 | | -The result of the conversion points to the same member as the pointer to |
1024 | | -member before the conversion took place, but it points to the base class |
1025 | | -member as if it were a member of the derived class. The result points to |
| 1023 | +The result of the conversion designates the same member as the pointer to |
| 1024 | +member before the conversion took place, but it designates the base class |
| 1025 | +member as if it were a member of the derived class. The result designates |
1026 | 1026 | the member in \tcode{D}'s instance of \tcode{B}. Since the result has |
1027 | 1027 | type ``pointer to member of \tcode{D} of type \cv{} \tcode{T}'', |
1028 | 1028 | indirection through it with a \tcode{D} object is valid. The result is the same |
|
2906 | 2906 | implicit~(\ref{class.mfct.non-static}, \ref{class.static}) or explicit |
2907 | 2907 | class member access\iref{expr.ref} whose \grammarterm{id-expression} is a |
2908 | 2908 | function member name, or a pointer-to-member |
2909 | | -expression\iref{expr.mptr.oper} pointing to a function member; the call is as a member of |
| 2909 | +expression\iref{expr.mptr.oper} of function type; the call is as a member of |
2910 | 2910 | the class object referred to by the |
2911 | 2911 | object expression. In the case of an implicit class |
2912 | 2912 | member access, the implied object is the one pointed to by \tcode{this}. |
|
3800 | 3800 | The null member pointer value\iref{conv.mem} is converted to the null |
3801 | 3801 | member pointer value of the destination type. If class \tcode{B} |
3802 | 3802 | contains the original member, or is a base or derived class of the class |
3803 | | -containing the original member, the resulting pointer to member points |
3804 | | -to the original member. Otherwise, the behavior is undefined. |
| 3803 | +containing the original member, the resulting pointer to member designates |
| 3804 | +the original member. Otherwise, the behavior is undefined. |
3805 | 3805 | \begin{note} |
3806 | 3806 | Although class \tcode{B} need not contain the original member, the |
3807 | 3807 | dynamic type of the object with which indirection through the pointer |
|
4186 | 4186 | \item |
4187 | 4187 | If the operand is a \grammarterm{qualified-id} naming a non-static or variant member \tcode{m} |
4188 | 4188 | of some class \tcode{C} with type \tcode{T}, the result has type ``pointer to member |
4189 | | -of class \tcode{C} of type \tcode{T}'' and is a prvalue pointing to \tcode{C::m}. |
| 4189 | +of class \tcode{C} of type \tcode{T}'' and is a prvalue designating \tcode{C::m}. |
4190 | 4190 | \item |
4191 | 4191 | Otherwise, if the operand is an lvalue of type \tcode{T}, |
4192 | 4192 | the resulting expression is a prvalue of type ``pointer to \tcode{T}'' |
|
5582 | 5582 | \end{bnf} |
5583 | 5583 |
|
5584 | 5584 | \pnum |
5585 | | -The binary operator \tcode{.*} binds its second operand, which shall be |
5586 | | -of type ``pointer to member of \tcode{T}'' to its first operand, which shall be |
5587 | | -a glvalue |
5588 | | -of |
5589 | | -class \tcode{T} or of a class of which \tcode{T} is an unambiguous and |
5590 | | -accessible base class. The result the object or a function to which the second operand points. |
5591 | | - |
5592 | | -\pnum |
5593 | | -The binary operator \tcode{->*} binds its second operand, which shall be |
5594 | | -of type ``pointer to member of \tcode{T}'' to its first operand, which shall be of |
5595 | | -type ``pointer to \tcode{U}'' |
5596 | | -where \tcode{U} is either \tcode{T} or |
5597 | | -a class of which \tcode{T} |
5598 | | -is an unambiguous and accessible base class. |
5599 | | -The expression \tcode{E1->*E2} is converted into the equivalent form |
5600 | | -\tcode{(*(E1)).*E2}. |
| 5585 | +In a pointer-to-member expression of the form \tcode{E1->*E2}, \tcode{E2} shall |
| 5586 | +be of type ``pointer to member of \tcode{T}'' and \tcode{E1} shall be of type |
| 5587 | +``pointer to \cv{}~\tcode{U}'' where \tcode{U} is \tcode{T} or a type which |
| 5588 | +\tcode{T} is an accessible unambiguous base class of. The expression is converted |
| 5589 | +to the equivalent form \tcode{(*(E1)).*E2}; the remainder of this subclause will |
| 5590 | +address only the operator \tcode{.*}. |
| 5591 | + |
| 5592 | +\pnum |
| 5593 | +Abbreviating \grammarterm{pm-expression}\tcode{.*}\grammarterm{cast-expression} as \tcode{E1.*E2}, |
| 5594 | +\tcode{E2} shall be of type ``pointer to member of \tcode{T}'', and \tcode{E1} shall be a glvalue |
| 5595 | +of type \tcode{T} or a type which \tcode{T} is an accessible unambiguous base class of |
| 5596 | +(ignoring cv-qualification). The expression \tcode{E1} is known as the \defn{object expression}. |
| 5597 | +If \tcode{E2} is the null-member-pointer value, or the member \tcode{E2} designates is not a |
| 5598 | +member of the the dynamic type of the object expression, the behavior is undefined. |
| 5599 | +The result is the member subobject or function designated |
| 5600 | +by \tcode{E2} corresponding to the object denoted by the object expression; |
| 5601 | +the expression is a prvalue if the result is a function, and otherwise has |
| 5602 | +the same value category as the (possibly-converted) object expression. |
| 5603 | +The expression \tcode{E1} is sequenced before the expression \tcode{E2}. |
5601 | 5604 |
|
5602 | 5605 | \pnum |
5603 | | -Abbreviating \grammarterm{pm-expression}\tcode{.*}\grammarterm{cast-expression} as \tcode{E1.*E2}, \tcode{E1} |
5604 | | -is called the \defn{object expression}. |
5605 | | -If the dynamic type of \tcode{E1} does not |
5606 | | -contain the member to which |
5607 | | -\tcode{E2} points, the behavior is undefined. |
5608 | | -Otherwise, the expression \tcode{E1} is sequenced before the expression \tcode{E2}. |
| 5606 | +The manner in which the cv-qualifiers of the operands are combined |
| 5607 | +to produce the cv-qualifiers of the result are the same as those |
| 5608 | +specified in~\ref{expr.ref} for the expression \tcode{E1.M}, where |
| 5609 | +the invented \grammarterm{id-expression} \tcode{M} denotes the same |
| 5610 | +member \tcode{E2} designates. |
5609 | 5611 |
|
5610 | | -\pnum |
5611 | | -The restrictions on cv-qualification, and the manner in which |
5612 | | -the cv-qualifiers of the operands are combined to produce the |
5613 | | -cv-qualifiers of the result, are the same as the rules for |
5614 | | -\tcode{E1.E2} given in~\ref{expr.ref}. |
5615 | 5612 | \begin{note} |
5616 | | -It is not possible to use a pointer to member that points to a |
| 5613 | +It is not possible to use a pointer to member designating a |
5617 | 5614 | \tcode{mutable} member to modify a const class object. For |
5618 | 5615 | example, |
5619 | 5616 | \begin{codeblock} |
|
5624 | 5621 | void f() |
5625 | 5622 | { |
5626 | 5623 | const S cs; |
5627 | | -int S::* pm = &S::i; // \tcode{pm} points to \tcode{mutable} member \tcode{S::i} |
| 5624 | +int S::* pm = &S::i; // \tcode{pm} designates the \tcode{mutable} member \tcode{S::i} |
5628 | 5625 | cs.*pm = 88; // error: \tcode{cs} is a const object |
5629 | 5626 | } |
5630 | 5627 | \end{codeblock} |
5631 | 5628 | \end{note} |
5632 | 5629 |
|
5633 | 5630 | \pnum |
5634 | 5631 | \indextext{function!pointer to member}% |
5635 | | -If the result of \tcode{.*} or \tcode{->*} is a function, then that |
5636 | | -result can be used only as the operand for the function call operator |
5637 | | -\tcode{()}. |
| 5632 | +If the result of a pointer-to-member expression is a function, the |
| 5633 | +result can be used only as the left-hand operand of a member function call. |
5638 | 5634 | \begin{example} |
5639 | 5635 | \begin{codeblock} |
5640 | 5636 | (ptr_to_obj->*ptr_to_mfct)(10); |
5641 | 5637 | \end{codeblock} |
5642 | | -calls the member function denoted by \tcode{ptr_to_mfct} for the object |
| 5638 | +calls the member function designated by \tcode{ptr_to_mfct} for the object |
5643 | 5639 | pointed to by \tcode{ptr_to_obj}. |
5644 | 5640 | \end{example} |
5645 | | -In a \tcode{.*} expression whose object expression is an rvalue, the program is |
5646 | | -ill-formed if the second operand is a pointer to member function |
5647 | | -whose \grammarterm{ref-qualifier} is \tcode{\&}, |
5648 | | -unless its \grammarterm{cv-qualifier-seq} is \tcode{const}. |
5649 | | -In a \tcode{.*} |
5650 | | -expression whose object expression is an lvalue, the program is ill-formed if the second |
5651 | | -operand is |
5652 | | -a pointer to member function |
5653 | | -whose \grammarterm{ref-qualifier} is \tcode{\&\&}. |
5654 | | -The result of a \tcode{.*} expression |
5655 | | -whose second operand is a pointer to a data member is an lvalue if the first |
5656 | | -operand is an lvalue and an xvalue otherwise. The result of a \tcode{.*} expression whose |
5657 | | -second operand is a pointer to a member function is a prvalue. |
5658 | | -If the second operand is the null |
5659 | | -member pointer value\iref{conv.mem}, the behavior is undefined. |
| 5641 | + |
| 5642 | +\pnum |
| 5643 | +In a pointer-to-member expression whose object expression is an xvalue, |
| 5644 | +if the second operand is of pointer-to-member-function type, the member type\iref{dcl.mptr} |
| 5645 | +shall not have the \grammarterm{ref-qualifier} \tcode{\&} unless its \grammarterm{cv-qualifier-seq} |
| 5646 | +is \tcode{const}. Similarly, in a pointer-to-member expression whose object expression is an lvalue, |
| 5647 | +if the second operand is of pointer-to-member-function type, the member type\iref{dcl.mptr} |
| 5648 | +shall not have the \grammarterm{ref-qualifier} \tcode{\&\&}. |
5660 | 5649 |
|
5661 | 5650 | \rSec2[expr.mul]{Multiplicative operators}% |
5662 | 5651 | \indextext{expression!multiplicative operators}% |
|
6154 | 6143 | If either is a pointer to a virtual member function, the result is unspecified. |
6155 | 6144 |
|
6156 | 6145 | \item |
6157 | | -If one points to a member of class \tcode{C1} and the other points to a member |
| 6146 | +If one designates a member of class \tcode{C1} and the other designates a member |
6158 | 6147 | of a different class \tcode{C2}, where neither is a base class of the other, |
6159 | 6148 | the result is unspecified. |
6160 | 6149 | \begin{example} |
|
6171 | 6160 | \end{example} |
6172 | 6161 |
|
6173 | 6162 | \item |
6174 | | -If both point to (possibly different) members of the same union\iref{class.union}, |
| 6163 | +If both designate (possibly different) members of the same union\iref{class.union}, |
6175 | 6164 | they compare equal. |
6176 | 6165 |
|
6177 | 6166 | \item |
6178 | | -Otherwise, two pointers to members compare equal if they would point to the same member of |
| 6167 | +Otherwise, two pointers to members compare equal if they would designate the same member of |
6179 | 6168 | the same most derived object\iref{intro.object} or the same subobject if |
6180 | 6169 | indirection with a hypothetical object of the associated |
6181 | 6170 | class type were performed, otherwise they compare unequal. |
|
7227 | 7216 |
|
7228 | 7217 | \item |
7229 | 7218 | if the value is of pointer-to-member-function type, |
7230 | | - it does not point to an immediate function, and |
| 7219 | + it does not designate an immediate function, and |
7231 | 7220 |
|
7232 | 7221 | \item |
7233 | 7222 | if the value is an object of class or array type, |
|
0 commit comments