|
555 | 555 | using-declaration\br |
556 | 556 | using-enum-declaration\br |
557 | 557 | static_assert-declaration\br |
| 558 | + consteval-block-declaration\br |
558 | 559 | template-declaration\br |
559 | 560 | explicit-specialization\br |
560 | 561 | deduction-guide\br |
|
646 | 647 | \end{note} |
647 | 648 |
|
648 | 649 | \pnum |
649 | | -A \grammarterm{member-declaration} does not declare new members of the class |
| 650 | +A \grammarterm{member-declaration} does not itself declare new members of the class |
650 | 651 | if it is |
651 | 652 | \begin{itemize} |
652 | 653 | \item a friend declaration\iref{class.friend}, |
653 | 654 | \item a \grammarterm{deduction-guide}\iref{temp.deduct.guide}, |
654 | 655 | \item a \grammarterm{template-declaration} whose \grammarterm{declaration} is one of the above, |
655 | 656 | \item a \grammarterm{static_assert-declaration}, |
| 657 | +\item a \grammarterm{consteval-block-declaration}, |
656 | 658 | \item a \grammarterm{using-declaration}\iref{namespace.udecl}, or |
657 | 659 | \item an \grammarterm{empty-declaration}. |
658 | 660 | \end{itemize} |
|
686 | 688 | Any other data member or member function is a \defnadj{non-static}{member} |
687 | 689 | (a \defnadj{non-static}{data member} or |
688 | 690 | \defnadj{non-static}{member function}\iref{class.mfct.non.static}, respectively). |
689 | | -\begin{note} |
690 | | -A non-static data member of non-reference |
691 | | -type is a member subobject of a class object\iref{intro.object}. |
692 | | -\end{note} |
| 691 | + |
| 692 | +\pnum |
| 693 | +Every object of class type has a unique member subobject |
| 694 | +corresponding to each of its direct non-static data members. |
| 695 | +If any non-static data member of a class \tcode{C} is of reference type, |
| 696 | +then let \tcode{D} be an invented class |
| 697 | +that is identical to \tcode{C} |
| 698 | +except that each non-static member of \tcode{D} corresponding to |
| 699 | +a member of \tcode{C} of type ``reference to \tcode{T}'' |
| 700 | +instead has type ``pointer to \tcode{T}''. |
| 701 | +Every member subobject of a complete object of type \tcode{C} |
| 702 | +has the same size, alignment, and offset |
| 703 | +as that of the corresponding subobject of a complete object of type \tcode{D}. |
| 704 | +The size and alignment of \tcode{C} are the same as |
| 705 | +the size and alignment of \tcode{D}. |
693 | 706 |
|
694 | 707 | \pnum |
695 | 708 | A member shall not be declared twice in the |
|
999 | 1012 | pointer-interconvertible\iref{basic.compound,expr.static.cast}. |
1000 | 1013 | \end{note} |
1001 | 1014 |
|
| 1015 | +\pnum |
| 1016 | +A \defnadj{data member}{description} is |
| 1017 | +a quintuple ($T$, $N$, $A$, $W$, $\mathit{NUA}$) |
| 1018 | +describing the potential declaration of a non-static data member where |
| 1019 | +\begin{itemize} |
| 1020 | +\item $T$ is a type, |
| 1021 | +\item $N$ is an identifier or $\bot$, |
| 1022 | +\item $A$ is an alignment or $\bot$, |
| 1023 | +\item $W$ is a bit-field width or $\bot$, and |
| 1024 | +\item $\mathit{NUA}$ is a boolean value. |
| 1025 | +\end{itemize} |
| 1026 | +Two data member descriptions are equal |
| 1027 | +if each of their respective components are the same entities, |
| 1028 | +are the same identifiers, have equal values, or are both $\bot$. |
| 1029 | +\begin{note} |
| 1030 | +The components of a data member description describe a data member such that |
| 1031 | +\begin{itemize} |
| 1032 | +\item |
| 1033 | +its type is specified using the type given by $T$, |
| 1034 | +\item |
| 1035 | +it is declared with the name given by $N$ |
| 1036 | +if $N$ is not $\bot$ and is otherwise unnamed, |
| 1037 | +\item |
| 1038 | +it is declared with the \grammarterm{alignment-specifier}\iref{dcl.align} |
| 1039 | +given by \tcode{alignas($A$)} |
| 1040 | +if $A$ is not $\bot$ and |
| 1041 | +is otherwise declared without an \grammarterm{alignment-specifier}, |
| 1042 | +\item |
| 1043 | +it is a bit-field\iref{class.bit} with the width given by $W$ |
| 1044 | +if W is not $\bot$ and is otherwise not a bit-field, and |
| 1045 | +\item |
| 1046 | +it is declared with |
| 1047 | +the attribute \tcode{[[no_unique_address]]}\iref{dcl.attr.nouniqueaddr} |
| 1048 | +if $\mathit{NUA}$ is true and is otherwise declared without that attribute. |
| 1049 | +\end{itemize} |
| 1050 | +Data member descriptions are represented by reflections\iref{basic.fundamental} |
| 1051 | +returned by \tcode{std::meta::data_member_spec}\iref{meta.reflection.define.aggregate} and |
| 1052 | +can be reified as data members of a class using \tcode{std::meta::define_aggregate}. |
| 1053 | +\end{note} |
| 1054 | + |
1002 | 1055 | \rSec2[class.mfct]{Member functions}% |
1003 | 1056 | \indextext{member function!class} |
1004 | 1057 |
|
|
3515 | 3568 | The class denoted by the \grammarterm{class-or-decltype} of |
3516 | 3569 | a \grammarterm{base-specifier} is called a |
3517 | 3570 | \defnadj{direct}{base class} |
3518 | | -for the class being defined. |
| 3571 | +for the class being defined; |
| 3572 | +for each such \grammarterm{base-specifier}, |
| 3573 | +the corresponding direct base class relationship |
| 3574 | +is the ordered pair (\tcode{D}, \tcode{B}) |
| 3575 | +where \tcode{D} is the class being defined and |
| 3576 | +\tcode{B} is the direct base class. |
3519 | 3577 | \indextext{base class}% |
3520 | 3578 | \indextext{derivation|see{inheritance}}% |
3521 | 3579 | The lookup for the component name of |
|
4346 | 4404 | \end{codeblock} |
4347 | 4405 | \end{example} |
4348 | 4406 | \begin{note} |
4349 | | -Because access control applies to the declarations named, if access control is applied to a |
4350 | | -\grammarterm{typedef-name}, only the accessibility of the typedef or alias declaration itself is considered. |
4351 | | -The accessibility of the entity referred to by the \grammarterm{typedef-name} is not considered. |
| 4407 | +Because access control applies to the declarations named, |
| 4408 | +if access control is applied to a type alias, |
| 4409 | +only the accessibility of the typedef or alias declaration itself is considered. |
| 4410 | +The accessibility of the underlying entity is not considered. |
4352 | 4411 | \begin{example} |
4353 | 4412 | \begin{codeblock} |
4354 | 4413 | class A { |
|
4739 | 4798 | to a pointer to a private or protected immediate base class of |
4740 | 4799 | \tcode{X}. |
4741 | 4800 | \end{note} |
4742 | | -The access to a member is affected by the class in which the member is |
4743 | | -named. |
4744 | | -This naming class is |
4745 | | -the class in whose scope name lookup performed a search that found the member. |
| 4801 | +An expression $E$ that designates a member \tcode{m} |
| 4802 | +has a \defnadj{designating}{class} |
| 4803 | +that affects the access to \tcode{m}. |
| 4804 | +This designating class is either |
| 4805 | +\begin{itemize} |
| 4806 | +\item |
| 4807 | +the innermost class of which \tcode{m} is directly a member |
| 4808 | +if $E$ is a \grammarterm{splice-expression} or |
| 4809 | +\item |
| 4810 | +the class in whose scope name lookup performed a search |
| 4811 | +that found \tcode{m} otherwise. |
| 4812 | +\end{itemize} |
4746 | 4813 | \begin{note} |
4747 | 4814 | This class can be explicit, e.g., when a |
4748 | 4815 | \grammarterm{qualified-id} |
|
4754 | 4821 | \grammarterm{qualified-id} |
4755 | 4822 | are used to name the member (as in |
4756 | 4823 | \tcode{p->T::m}), |
4757 | | -the class naming the member is the class denoted by the |
| 4824 | +the class designating the member is the class designated by the |
4758 | 4825 | \grammarterm{nested-name-specifier} |
4759 | 4826 | of the |
4760 | 4827 | \grammarterm{qualified-id} |
|
4765 | 4832 | \tcode{m} |
4766 | 4833 | is accessible at the point |
4767 | 4834 | \placeholder{R} |
4768 | | -when named in class |
| 4835 | +when designated in class |
4769 | 4836 | \tcode{N} |
4770 | 4837 | if |
4771 | 4838 | \begin{itemize} |
4772 | 4839 | \item |
| 4840 | +\tcode{m} is designated by a \grammarterm{splice-expression}, or |
| 4841 | +\item |
4773 | 4842 | \tcode{m} |
4774 | 4843 | as a member of |
4775 | 4844 | \tcode{N} |
|
4837 | 4906 | left operand (considered as a pointer in the |
4838 | 4907 | ``\tcode{.}'' |
4839 | 4908 | operator case) cannot be implicitly converted to a |
4840 | | -pointer to the naming class of the right operand. |
| 4909 | +pointer to the designating class of the right operand. |
4841 | 4910 | \begin{note} |
4842 | 4911 | This requirement is in addition to the requirement that |
4843 | | -the member be accessible as named. |
| 4912 | +the member be accessible as designated. |
4844 | 4913 | \end{note} |
4845 | 4914 |
|
4846 | 4915 | \rSec2[class.friend]{Friends}% |
|
0 commit comments