|
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 |
|
|
3514 | 3567 | The class denoted by the \grammarterm{class-or-decltype} of |
3515 | 3568 | a \grammarterm{base-specifier} is called a |
3516 | 3569 | \defnadj{direct}{base class} |
3517 | | -for the class being defined. |
| 3570 | +for the class being defined; |
| 3571 | +for each such \grammarterm{base-specifier}, |
| 3572 | +the corresponding \defnadj{direct base class}{relationship} |
| 3573 | +is the ordered pair (\tcode{D}, \tcode{B}) |
| 3574 | +where \tcode{D} is the class being defined and |
| 3575 | +\tcode{B} is the direct base class. |
3518 | 3576 | \indextext{base class}% |
3519 | 3577 | \indextext{derivation|see{inheritance}}% |
3520 | 3578 | The lookup for the component name of |
|
4345 | 4403 | \end{codeblock} |
4346 | 4404 | \end{example} |
4347 | 4405 | \begin{note} |
4348 | | -Because access control applies to the declarations named, if access control is applied to a |
4349 | | -\grammarterm{typedef-name}, only the accessibility of the typedef or alias declaration itself is considered. |
4350 | | -The accessibility of the entity referred to by the \grammarterm{typedef-name} is not considered. |
| 4406 | +Because access control applies to the declarations named, |
| 4407 | +if access control is applied to a type alias, |
| 4408 | +only the accessibility of the typedef or alias declaration itself is considered. |
| 4409 | +The accessibility of the underlying entity is not considered. |
4351 | 4410 | \begin{example} |
4352 | 4411 | \begin{codeblock} |
4353 | 4412 | class A { |
|
4738 | 4797 | to a pointer to a private or protected immediate base class of |
4739 | 4798 | \tcode{X}. |
4740 | 4799 | \end{note} |
4741 | | -The access to a member is affected by the class in which the member is |
4742 | | -named. |
4743 | | -This naming class is |
4744 | | -the class in whose scope name lookup performed a search that found the member. |
| 4800 | +An expression $E$ that designates a member \tcode{m} |
| 4801 | +has a \defnadj{designating}{class} |
| 4802 | +that affects the access to \tcode{m}. |
| 4803 | +This designating class is either |
| 4804 | +\begin{itemize} |
| 4805 | +\item |
| 4806 | +the innermost class of which \tcode{m} is directly a member |
| 4807 | +if $E$ is a \grammarterm{splice-expression} or |
| 4808 | +\item |
| 4809 | +the class in whose scope name lookup performed a search |
| 4810 | +that found \tcode{m} otherwise. |
| 4811 | +\end{itemize} |
4745 | 4812 | \begin{note} |
4746 | 4813 | This class can be explicit, e.g., when a |
4747 | 4814 | \grammarterm{qualified-id} |
|
4753 | 4820 | \grammarterm{qualified-id} |
4754 | 4821 | are used to name the member (as in |
4755 | 4822 | \tcode{p->T::m}), |
4756 | | -the class naming the member is the class denoted by the |
| 4823 | +the class designating the member is the class designated by the |
4757 | 4824 | \grammarterm{nested-name-specifier} |
4758 | 4825 | of the |
4759 | 4826 | \grammarterm{qualified-id} |
|
4764 | 4831 | \tcode{m} |
4765 | 4832 | is accessible at the point |
4766 | 4833 | \placeholder{R} |
4767 | | -when named in class |
| 4834 | +when designated in class |
4768 | 4835 | \tcode{N} |
4769 | 4836 | if |
4770 | 4837 | \begin{itemize} |
4771 | 4838 | \item |
| 4839 | +\tcode{m} is designated by a \grammarterm{splice-expression}, or |
| 4840 | +\item |
4772 | 4841 | \tcode{m} |
4773 | 4842 | as a member of |
4774 | 4843 | \tcode{N} |
|
4810 | 4879 | \tcode{m} |
4811 | 4880 | is accessible at |
4812 | 4881 | \placeholder{R} |
4813 | | -when named in class |
| 4882 | +when designated in class |
4814 | 4883 | \tcode{B}. |
4815 | 4884 | \begin{example} |
4816 | 4885 | \begin{codeblock} |
|
4836 | 4905 | left operand (considered as a pointer in the |
4837 | 4906 | ``\tcode{.}'' |
4838 | 4907 | operator case) cannot be implicitly converted to a |
4839 | | -pointer to the naming class of the right operand. |
| 4908 | +pointer to the designating class of the right operand. |
4840 | 4909 | \begin{note} |
4841 | 4910 | This requirement is in addition to the requirement that |
4842 | | -the member be accessible as named. |
| 4911 | +the member be accessible as designated. |
4843 | 4912 | \end{note} |
4844 | 4913 |
|
4845 | 4914 | \rSec2[class.friend]{Friends}% |
|
0 commit comments