diff --git a/source/basic.tex b/source/basic.tex index 822934d641..41597c6c80 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -5014,9 +5014,10 @@ Types \keyword{bool}, \keyword{char}, \keyword{wchar_t}, -\keyword{char8_t}, \keyword{char16_t}, \keyword{char32_t}, -and the signed and unsigned integer types are -collectively called +\keyword{char8_t}, \keyword{char16_t}, \keyword{char32_t}, and +the signed and unsigned integer types, +and cv-qualified versions\iref{basic.type.qualifier} thereof, +are collectively termed \defnx{integral types}{integral type}. A synonym for integral type is \defn{integer type}. \begin{note} @@ -5027,19 +5028,26 @@ \pnum \indextext{floating-point type|see{type, floating-point}}% -There are three \defnx{floating-point types}{type!floating-point}: +The three distinct types \indextext{type!\idxcode{float}}% \keyword{float}, \indextext{type!\idxcode{double}}% \keyword{double}, and \indextext{type!\idxcode{long double}}% -\tcode{\keyword{long} \keyword{double}}. The type \keyword{double} provides at least as much +\tcode{\keyword{long} \keyword{double}} +can represent floating-point numbers. +The type \keyword{double} provides at least as much precision as \keyword{float}, and the type \tcode{\keyword{long} \keyword{double}} provides at least as much precision as \keyword{double}. The set of values of the type \keyword{float} is a subset of the set of values of the type \keyword{double}; the set of values of the type \keyword{double} is a subset -of the set of values of the type \tcode{\keyword{long} \keyword{double}}. The value +of the set of values of the type \tcode{\keyword{long} \keyword{double}}. +The types +\keyword{float}, \keyword{double}, and \tcode{\keyword{long} \keyword{double}}, +and cv-qualified versions\iref{basic.type.qualifier} thereof, +are collectively termed \defnx{floating-point types}{type!floating-point}. +The value representation of floating-point types is \impldef{value representation of floating-point types}. \indextext{floating-point type!implementation-defined}% @@ -5048,7 +5056,7 @@ floating-point operations; see also~\ref{support.limits}. \end{note} Integral and floating-point types are collectively -called \defnx{arithmetic}{type!arithmetic} types. +termed \defnx{arithmetic types}{type!arithmetic}. \indextext{\idxcode{numeric_limits}!specializations for arithmetic types}% Specializations of the standard library template \tcode{std::numeric_limits}\iref{support.limits} shall specify the @@ -5267,18 +5275,22 @@ \indextext{cv-qualifier}% \indextext{\idxcode{const}}% \indextext{\idxcode{volatile}}% -A type mentioned in~\ref{basic.fundamental} and~\ref{basic.compound} is -a \defnadj{cv-unqualified}{type}. Each type which is a -cv-unqualified object type or is -\keyword{void}\iref{basic.types} has three corresponding cv-qualified -versions of its type: a \defn{const-qualified} version, a -\defn{volatile-qualified} version, and a -\defn{const-volatile-qualified} version. The -type of an object\iref{intro.object} includes the \grammarterm{cv-qualifier}{s} -specified in the \grammarterm{decl-specifier-seq}\iref{dcl.spec}, -\grammarterm{declarator}\iref{dcl.decl}, -\grammarterm{type-id}\iref{dcl.name}, or -\grammarterm{new-type-id}\iref{expr.new} when the object is created. +Each type other than a function or reference type +is part of a group of four distinct, but related, types: +a \defn{cv-unqualified} version, +a \defn{const-qualified} version, +a \defn{volatile-qualified} version, and +a \defn{const-volatile-qualified} version. +The types in each such group shall have +the same representation and alignment requirements\iref{basic.align}. +\begin{footnote} +The same representation and alignment requirements +are meant to imply interchangeability as +arguments to functions, +return values from functions, and +non-static data members of unions. +\end{footnote} +A function or reference type is always cv-unqualified. \begin{itemize} \item A \defnadj{const}{object} is an object of type \tcode{\keyword{const} T} or a non-mutable subobject of a const object. @@ -5291,16 +5303,15 @@ a const subobject of a volatile object, or a non-mutable volatile subobject of a const object. \end{itemize} -The cv-qualified or -cv-unqualified versions of a type -are distinct types; however, they shall have the same representation and -alignment requirements\iref{basic.align}. -\begin{footnote} -The same representation -and alignment requirements are meant to imply -interchangeability as arguments to functions, return values from -functions, and non-static data members of unions. -\end{footnote} +\begin{note} +The type of an object\iref{intro.object} includes +the \grammarterm{cv-qualifier}s specified in the +\grammarterm{decl-specifier-seq}\iref{dcl.spec}, +\grammarterm{declarator}\iref{dcl.decl}, +\grammarterm{type-id}\iref{dcl.name}, or +\grammarterm{new-type-id}\iref{expr.new} +when the object is created. +\end{note} \pnum Except for array types, a compound type\iref{basic.compound} is not cv-qualified by the @@ -5663,28 +5674,27 @@ \end{example} \pnum -When calling a function (whether or not the function is inline), every -\indextext{value computation}% -value computation and -\indextext{side effects}% -side effect associated with any argument -expression, or with the postfix expression designating the called -function, is sequenced before execution of every expression or statement +When invoking a function (whether or not the function is inline), +every argument expression and +the postfix expression designating the called function +are sequenced before every expression or statement in the body of the called function. -For each function invocation \placeholder{F}, -for every evaluation \placeholder{A} that occurs within \placeholder{F} and -every evaluation \placeholder{B} that does not occur within \placeholder{F} but -is evaluated on the same thread and as part of the same signal handler (if any), -either \placeholder{A} is sequenced before \placeholder{B} or -\placeholder{B} is sequenced before \placeholder{A}. +For each function invocation or +evaluation of an \grammarterm{await-expression} \placeholder{F}, +each evaluation that does not occur within \placeholder{F} but +is evaluated on the same thread and as part of the same signal handler (if any) +is either sequenced before all evaluations that occur within \placeholder{F} +or sequenced after all evaluations that occur within \placeholder{F}; \begin{footnote} In other words, function executions do not interleave with each other. \end{footnote} -\begin{note} -If \placeholder{A} and \placeholder{B} would not otherwise be sequenced then they are -indeterminately sequenced. -\end{note} +if \placeholder{F} invokes or resumes a coroutine\iref{expr.await}, +only evaluations +subsequent to the previous suspension (if any) and +prior to the next suspension (if any) +are considered to occur within \placeholder{F}. + Several contexts in \Cpp{} cause evaluation of a function call, even though no corresponding function call syntax appears in the translation unit. @@ -6419,7 +6429,7 @@ The linkage\iref{basic.link} of \tcode{main} is \impldef{linkage of \tcode{main}}. A program that defines \tcode{main} as deleted or that declares \tcode{main} to be -\keyword{inline}, \keyword{static}, or \keyword{constexpr} is ill-formed. +\keyword{inline}, \keyword{static}, \keyword{constexpr}, or \keyword{consteval} is ill-formed. The function \tcode{main} shall not be a coroutine\iref{dcl.fct.def.coroutine}. The \tcode{main} function shall not be declared with a \grammarterm{linkage-specification}\iref{dcl.link}. diff --git a/source/classes.tex b/source/classes.tex index a5a7cc27a0..266bce64b4 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -1141,8 +1141,12 @@ \end{itemize} Constructors do not have names. In a constructor declaration, each \grammarterm{decl-specifier} in the optional -\grammarterm{decl-specifier-seq} shall be \keyword{friend}, \keyword{inline}, -\keyword{constexpr}, or an \grammarterm{explicit-specifier}. +\grammarterm{decl-specifier-seq} shall be +\keyword{friend}, +\keyword{inline}, +\keyword{constexpr}, +\keyword{consteval}, or +an \grammarterm{explicit-specifier}. \begin{example} \begin{codeblock} struct S { @@ -1480,7 +1484,7 @@ a non-explicit one is declared \defnx{implicitly}{constructor!copy!implicitly declared}. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy -constructor is defined as deleted; otherwise, it is defined as +constructor is defined as deleted; otherwise, it is defaulted\iref{dcl.fct.def}. The latter case is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor \iref{depr.impldec}. @@ -1734,7 +1738,7 @@ one is declared \defnx{implicitly}{assignment operator!copy!implicitly declared}. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy -assignment operator is defined as deleted; otherwise, it is defined as +assignment operator is defined as deleted; otherwise, it is defaulted\iref{dcl.fct.def}. The latter case is deprecated if the class has a user-declared copy constructor or a user-declared destructor \iref{depr.impldec}. diff --git a/source/declarations.tex b/source/declarations.tex index 31ef69fc3a..9858dbaa6a 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -1924,6 +1924,7 @@ and $E$ is the corresponding template argument. \end{itemize} +\tcode{T} shall not be an array type. In the case of a \tcode{return} statement with no operand or with an operand of type \keyword{void}, \tcode{T} shall be either @@ -2616,6 +2617,8 @@ \keyword{inline}, \keyword{virtual}, \keyword{constexpr}, +\keyword{consteval}, +\keyword{constinit}, or \tcode{typedef} specifier @@ -3143,7 +3146,6 @@ \pnum \tcode{U} is called the array \defn{element type}; this type shall not be -a placeholder type\iref{dcl.spec.auto}, a reference type, a function type, an array of unknown bound, or @@ -3606,6 +3608,9 @@ \indextext{function return type|see{return type}}% \indextext{return type}% The return type shall be a non-array object type, a reference type, or \cv{}~\keyword{void}. +\begin{note} +An array of placeholder type is considered an array type. +\end{note} \pnum A volatile-qualified return type is deprecated; @@ -5492,9 +5497,10 @@ \item Otherwise, the initializer expression is implicitly converted to a prvalue -of type ``\cvqual{cv1} \tcode{T1}''. -The temporary materialization conversion is applied and the reference is -bound to the result. +of type ``\tcode{T1}''. +The temporary materialization conversion is applied, +considering the type of the prvalue to be ``\cvqual{cv1} \tcode{T1}'', +and the reference is bound to the result. \end{itemize} If @@ -6362,6 +6368,11 @@ for a non-static member function, and $\tcode{p}_i$ denotes the $i^\textrm{th}$ function parameter otherwise. +For a non-static member function, +$\tcode{q}_1$ is an lvalue that denotes \tcode{*this}; +any other $\tcode{q}_i$ is an lvalue +that denotes the parameter copy corresponding to $\tcode{p}_i$, +as described below. \pnum A coroutine behaves as if its \grammarterm{function-body} were replaced by: @@ -6409,10 +6420,10 @@ \item \placeholder{promise-constructor-arguments} is determined as follows: overload resolution is performed on a promise constructor call created by -assembling an argument list with lvalues $\tcode{p}_1 \dotsc \tcode{p}_n$. If a viable +assembling an argument list $\tcode{q}_1 \dotsc \tcode{q}_n$. If a viable constructor is found\iref{over.match.viable}, then \placeholder{promise-constructor-arguments} is -\tcode{(p$_1$, $\dotsc$, p$_n$)}, otherwise +\tcode{($\tcode{q}_1$, $\dotsc$, $\tcode{q}_n$)}, otherwise \placeholder{promise-constructor-arguments} is empty. \end{itemize} diff --git a/source/expressions.tex b/source/expressions.tex index 0383ec9d7e..7a55ba6d7f 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -1581,15 +1581,23 @@ \grammarterm{decltype-specifier} \tcode{::} \tcode{\~} \grammarterm{type-name}. \pnum -The result of a \grammarterm{qualified-id} is +The result of a \grammarterm{qualified-id} $Q$ is the entity it denotes\iref{basic.lookup.qual}. The type of the expression is the type of the result. The result is an lvalue if the member is -a function, +\begin{itemize} +\item +a function other than a non-static member function, +\item +a non-static member function +if $Q$ is the operand of a unary \tcode{\&} operator, +\item a variable, -a structured binding\iref{dcl.struct.bind}, -a static member function, or +\item +a structured binding\iref{dcl.struct.bind}, or +\item a data member, +\end{itemize} and a prvalue otherwise. \rSec3[expr.prim.id.dtor]{Destruction} @@ -4313,22 +4321,21 @@ \pnum \indextext{name!address of cv-qualified}% \indextext{expression!pointer-to-member constant}% -The result of the unary \tcode{\&} operator is a pointer to its operand. +The operand of the unary \tcode{\&} operator +shall be an lvalue of some type \tcode{T}. +The result is a prvalue. \begin{itemize} \item If the operand is a \grammarterm{qualified-id} naming a non-static or variant member \tcode{m} -of some class \tcode{C} with type \tcode{T}, the result has type ``pointer to member -of class \tcode{C} of type \tcode{T}'' and is a prvalue designating \tcode{C::m}. +of some class \tcode{C}, the result has type ``pointer to member +of class \tcode{C} of type \tcode{T}'' and designates \tcode{C::m}. \item -Otherwise, if the operand is an lvalue of type \tcode{T}, -the resulting expression is a prvalue of type ``pointer to \tcode{T}'' -whose result is a pointer to the designated object\iref{intro.memory} or function. +Otherwise, the result has type ``pointer to \tcode{T}'' and points to +the designated object\iref{intro.memory} or function\iref{basic.compound}. \begin{note} In particular, taking the address of a variable of type ``\cv{}~\tcode{T}'' yields a pointer of type ``pointer to \cv{}~\tcode{T}''. \end{note} -\item -Otherwise, the program is ill-formed. \end{itemize} \begin{example} \begin{codeblock} @@ -4602,6 +4609,10 @@ the \placeholder{await-resume} expression is evaluated, and its result is the result of the \grammarterm{await-expression}. \end{itemize} +\begin{note} +With respect to sequencing, +an \grammarterm{await-expression} is indivisible\iref{intro.execution}. +\end{note} \pnum \begin{example} @@ -5450,14 +5461,14 @@ \pnum \indextext{\idxcode{delete}!undefined}% In a single-object delete expression, if the static type of the object to be -deleted is different from its dynamic type +deleted is not similar\iref{conv.qual} to its dynamic type and the selected deallocation function (see below) is not a destroying operator delete, the static type shall be a base class of the dynamic type of the object to be deleted and the static type shall have a virtual destructor or the behavior is undefined. In an array delete -expression, if the dynamic type of the object to be deleted differs from its -static type, the behavior is undefined. +expression, if the dynamic type of the object to be deleted is not similar to +its static type, the behavior is undefined. \pnum The \grammarterm{cast-expression} in a \grammarterm{delete-expression} shall diff --git a/source/overloading.tex b/source/overloading.tex index 8c78287245..ee0f0d1e21 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -3409,7 +3409,7 @@ \indextext{type!arithmetic!promoted}% In this subclause, the term \defn{promoted integral type} -is used to refer to those integral types which are preserved by +is used to refer to those cv-unqualified integral types which are preserved by integral promotion\iref{conv.prom} (including e.g. \tcode{int} and @@ -3432,53 +3432,20 @@ \cvqual{vq}), where \tcode{\placeholder{T}} -is an arithmetic type other than \tcode{bool}, +is a cv-unqualified arithmetic type other than \tcode{bool} +or a cv-unqualified pointer to (possibly cv-qualified) object type, there exist candidate operator functions of the form \begin{codeblock} @\cvqual{vq} \placeholder{T}@& operator++(@\cvqual{vq} \placeholder{T}@&); @\placeholder{T}@ operator++(@\cvqual{vq} \placeholder{T}@&, int); -\end{codeblock} - -\pnum -For every pair -(\tcode{\placeholder{T}}, -\cvqual{vq}), -where -\tcode{\placeholder{T}} -is an arithmetic type other than -\tcode{bool}, -there exist candidate operator functions of the form -\begin{codeblock} @\cvqual{vq} \placeholder{T}@& operator--(@\cvqual{vq} \placeholder{T}@&); @\placeholder{T}@ operator--(@\cvqual{vq} \placeholder{T}@&, int); \end{codeblock} \pnum -For every pair -(\tcode{\placeholder{T}}, -\cvqual{vq}), -where -\tcode{\placeholder{T}} -is a cv-qualified or cv-unqualified object type, -there exist candidate operator functions of the form -\begin{codeblock} -@\placeholder{T}@*@\cvqual{vq}@& operator++(@\placeholder{T}@*@\cvqual{vq}@&); -@\placeholder{T}@*@\cvqual{vq}@& operator--(@\placeholder{T}@*@\cvqual{vq}@&); -@\placeholder{T}@* operator++(@\placeholder{T}@*@\cvqual{vq}@&, int); -@\placeholder{T}@* operator--(@\placeholder{T}@*@\cvqual{vq}@&, int); -\end{codeblock} - -\pnum -For every cv-qualified or cv-unqualified object type -\tcode{\placeholder{T}}, -there exist candidate operator functions of the form -\begin{codeblock} -@\placeholder{T}@& operator*(@\placeholder{T}@*); -\end{codeblock} - -\pnum -For every function type -\tcode{\placeholder{T}} that does not have cv-qualifiers or a \grammarterm{ref-qualifier}, +For every (possibly cv-qualified) object type \tcode{\placeholder{T}} and +for every function type \tcode{\placeholder{T}} +that has neither \grammarterm{cv-qualifier}s nor a \grammarterm{ref-qualifier}, there exist candidate operator functions of the form \begin{codeblock} @\placeholder{T}@& operator*(@\placeholder{T}@*); @@ -3491,7 +3458,7 @@ \end{codeblock} \pnum -For every floating-point or promoted integral type \tcode{\placeholder{T}}, +For every cv-unqualified floating-point or promoted integral type \tcode{\placeholder{T}}, there exist candidate operator functions of the form \begin{codeblock} @\placeholder{T}@ operator+(@\placeholder{T}@);