|
205 | 205 |
|
206 | 206 | \pnum
|
207 | 207 | If the \grammarterm{decl-specifier-seq} contains the \keyword{typedef}
|
208 |
| -specifier, the declaration is called a \defnx{typedef declaration}{declaration!typedef} |
| 208 | +specifier, the declaration is a \defnx{typedef declaration}{declaration!typedef} |
209 | 209 | and each \grammarterm{declarator-id}
|
210 | 210 | is declared to be a \grammarterm{typedef-name}, synonymous with its
|
211 | 211 | associated type\iref{dcl.typedef}.
|
212 | 212 | \begin{note}
|
213 | 213 | Such a \grammarterm{declarator-id} is
|
214 | 214 | an \grammarterm{identifier}\iref{class.conv.fct}.
|
215 | 215 | \end{note}
|
216 |
| -If the |
217 |
| -\grammarterm{decl-specifier-seq} contains no \keyword{typedef} specifier, the |
218 |
| -declaration is called a \defnx{function declaration}{declaration!function} if |
219 |
| -the type associated with a \grammarterm{declarator-id} is a function type\iref{dcl.fct} and |
220 |
| -an \defnx{object declaration}{declaration!object} otherwise. |
| 216 | +Otherwise, if the type associated with a \grammarterm{declarator-id} |
| 217 | +is a function type\iref{dcl.fct}, |
| 218 | +the declaration is a \defnx{function declaration}{declaration!function}. |
| 219 | +Otherwise, if the type associated with a \grammarterm{declarator-id} |
| 220 | +is an object or reference type, the declaration is |
| 221 | +an \defnx{object declaration}{declaration!object}. |
| 222 | +Otherwise, the program is ill-formed. |
| 223 | +\begin{example} |
| 224 | +\begin{codeblock} |
| 225 | +int f(), x; // OK, function declaration for \tcode{f} and object declaration for \tcode{x} |
| 226 | +extern void g(), // OK, function declaration for \tcode{g} |
| 227 | + y; // error: \tcode{void} is not an object type |
| 228 | +\end{codeblock} |
| 229 | +\end{example} |
221 | 230 |
|
222 | 231 | \pnum
|
223 | 232 | \indextext{definition!declaration as}%
|
|
787 | 796 | \pnum
|
788 | 797 | \indextext{specifier!\idxcode{constexpr}!function}%
|
789 | 798 | \indextext{constexpr function}%
|
790 |
| -The definition of a constexpr function shall satisfy the following |
791 |
| -requirements: |
| 799 | +A function is \defn{constexpr-suitable} if: |
792 | 800 | \begin{itemize}
|
793 | 801 | \item
|
794 |
| -it shall not be a coroutine\iref{dcl.fct.def.coroutine}; |
| 802 | +it is not a coroutine\iref{dcl.fct.def.coroutine}, and |
795 | 803 |
|
796 | 804 | \item
|
797 | 805 | if the function is a constructor or destructor,
|
798 |
| -its class shall not have any virtual base classes. |
| 806 | +its class does not have any virtual base classes. |
799 | 807 | \end{itemize}
|
| 808 | +Except for instantiated constexpr functions, |
| 809 | +non-templated constexpr functions shall be constexpr-suitable. |
800 | 810 |
|
801 | 811 | \begin{example}
|
802 | 812 | \begin{codeblock}
|
|
830 | 840 | \end{codeblock}
|
831 | 841 | \end{example}
|
832 | 842 |
|
833 |
| -\pnum |
834 |
| -If the instantiated template specialization of a constexpr function |
835 |
| -template |
836 |
| -or member function of a class template |
837 |
| -would fail to satisfy the requirements for a constexpr |
838 |
| -function, |
839 |
| -that specialization is still a constexpr function, |
840 |
| -even though a call to such a function cannot appear in a constant |
841 |
| -expression. |
842 |
| - |
843 | 843 | \pnum
|
844 | 844 | An invocation of a constexpr function in a given context
|
845 | 845 | produces the same result as
|
|
885 | 885 | In any \keyword{constexpr} variable declaration,
|
886 | 886 | the full-expression of the initialization
|
887 | 887 | shall be a constant expression\iref{expr.const}.
|
888 |
| -A \keyword{constexpr} variable shall have constant destruction. |
| 888 | +A \keyword{constexpr} variable that is an object, |
| 889 | +as well as any temporary to which a \keyword{constexpr} reference is bound, |
| 890 | +shall have constant destruction. |
889 | 891 | \begin{example}
|
890 | 892 | \begin{codeblock}
|
891 | 893 | struct pixel {
|
|
909 | 911 |
|
910 | 912 | \pnum
|
911 | 913 | If a variable declared with the \keyword{constinit} specifier has
|
912 |
| -dynamic initialization\iref{basic.start.dynamic}, the program is ill-formed. |
| 914 | +dynamic initialization\iref{basic.start.dynamic}, the program is ill-formed, |
| 915 | +even if the implementation would perform that initialization as |
| 916 | +a static initialization\iref{basic.start.static}. |
913 | 917 | \begin{note}
|
914 | 918 | The \keyword{constinit} specifier ensures that the variable
|
915 |
| -is initialized during static initialization\iref{basic.start.static}. |
| 919 | +is initialized during static initialization. |
916 | 920 | \end{note}
|
917 | 921 |
|
918 | 922 | \pnum
|
|
1747 | 1751 | \end{example}
|
1748 | 1752 |
|
1749 | 1753 | \pnum
|
1750 |
| -Return type deduction for a templated entity |
1751 |
| -that is a function or function template with a placeholder in its |
| 1754 | +Return type deduction for a templated |
| 1755 | +function with a placeholder in its |
1752 | 1756 | declared type occurs when the definition is instantiated even if the function
|
1753 | 1757 | body contains a \tcode{return} statement with a non-type-dependent operand.
|
1754 | 1758 | \begin{note}
|
|
6252 | 6256 | A function explicitly defaulted on its first declaration
|
6253 | 6257 | is implicitly inline\iref{dcl.inline},
|
6254 | 6258 | and is implicitly constexpr\iref{dcl.constexpr}
|
6255 |
| -if it satisfies the requirements for a constexpr function. |
| 6259 | +if it is constexpr-suitable. |
6256 | 6260 |
|
6257 | 6261 | \pnum
|
6258 | 6262 | \begin{example}
|
|
6968 | 6972 | not omit the \grammarterm{enum-base}.
|
6969 | 6973 | The identifiers in an \grammarterm{enumerator-list} are declared as
|
6970 | 6974 | constants, and can appear wherever constants are required.
|
| 6975 | +The same identifier shall not appear as |
| 6976 | +the name of multiple enumerators in an \grammarterm{enumerator-list}. |
6971 | 6977 | \indextext{enumerator!value of}%
|
6972 | 6978 | An \grammarterm{enumerator-definition} with \tcode{=} gives the associated
|
6973 | 6979 | \grammarterm{enumerator} the value indicated by the
|
|
8251 | 8257 | in determining the language linkage of
|
8252 | 8258 | class members,
|
8253 | 8259 | friend functions with a trailing \grammarterm{requires-clause}, and the
|
8254 |
| -function type of class member functions. |
| 8260 | +function type of non-static class member functions. |
8255 | 8261 | \begin{example}
|
8256 | 8262 | \begin{codeblock}
|
8257 | 8263 | extern "C" typedef void FUNC_c();
|
|
8505 | 8511 | the rules specifying to which entity or statement the attribute can apply or
|
8506 | 8512 | the syntax rules for the attribute's \grammarterm{attribute-argument-clause}, if any.
|
8507 | 8513 | \end{note}
|
| 8514 | +\begin{note} |
| 8515 | +The \grammarterm{attribute}{s} specified in \ref{dcl.attr} |
| 8516 | +have optional semantics: |
| 8517 | +given a well-formed program, |
| 8518 | +removing all instances of any one of those \grammarterm{attribute}{s} |
| 8519 | +results in a program whose set of possible executions\iref{intro.abstract} |
| 8520 | +for a given input is |
| 8521 | +a subset of those of the original program for the same input, |
| 8522 | +absent implementation-defined guarantees |
| 8523 | +with respect to that \grammarterm{attribute}. |
| 8524 | +\end{note} |
8508 | 8525 | An \grammarterm{attribute-token} is reserved for future standardization if
|
8509 | 8526 | \begin{itemize}
|
8510 | 8527 | \item it is not an \grammarterm{attribute-scoped-token} and
|
|
0 commit comments