diff --git a/source/declarations.tex b/source/declarations.tex index b941b09c2e..7c0c694c1d 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6192,9 +6192,10 @@ ``\cvqual{cv1} \tcode{T1}'' by user-defined conversion\iref{dcl.init,over.match.copy,over.match.conv}; the program is ill-formed if the corresponding non-reference -copy-initialization would be ill-formed. The result of the call to the +copy-initialization would be ill-formed. The result $E$ of the call to the conversion function, as described for the non-reference -copy-initialization, is then used to direct-initialize the reference. +copy-initialization, is then used to direct-initialize the reference +using the form \tcode{($E$)}. For this direct-initialization, user-defined conversions are not considered. \item Otherwise, diff --git a/source/expressions.tex b/source/expressions.tex index 82baa936f4..ca85894260 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -4384,8 +4384,7 @@ If \tcode{T} is an lvalue reference type or an rvalue reference to function type, the result is an lvalue; if \tcode{T} is an rvalue reference to object type, the result is an xvalue; -otherwise, the result is a prvalue. The \keyword{static_cast} operator shall not cast -away constness\iref{expr.const.cast}. +otherwise, the result is a prvalue. \pnum \indextext{cast!static!reference}% @@ -4474,36 +4473,11 @@ \end{note} \pnum -Otherwise, -the inverse of a standard conversion sequence\iref{conv} not containing an -lvalue-to-rvalue\iref{conv.lval}, -array-to-pointer\iref{conv.array}, -function-to-pointer\iref{conv.func}, -null pointer\iref{conv.ptr}, null member pointer\iref{conv.mem}, -boolean\iref{conv.bool}, or -function pointer\iref{conv.fctptr} -conversion, can be performed explicitly using \keyword{static_cast}. A -program is ill-formed if it uses \keyword{static_cast} to perform the -inverse of an ill-formed standard conversion sequence. -\begin{example} -\begin{codeblock} -struct B { }; -struct D : private B { }; -void f() { - static_cast((B*)0); // error: \tcode{B} is a private base of \tcode{D} - static_cast((int D::*)0); // error: \tcode{B} is a private base of \tcode{D} -} -\end{codeblock} -\end{example} - -\pnum -The lvalue-to-rvalue\iref{conv.lval}, +Otherwise, the lvalue-to-rvalue\iref{conv.lval}, array-to-pointer\iref{conv.array}, and function-to-pointer\iref{conv.func} conversions are applied to the -operand. Such a \keyword{static_cast} is subject to the restriction that -the explicit conversion does not cast away -constness\iref{expr.const.cast}, and the following additional rules -for specific cases: +operand, and the conversions that can be performed using \keyword{static_cast} are listed below. +No other conversion can be performed using \keyword{static_cast}. \pnum A value of a scoped enumeration type\iref{dcl.enum} @@ -4619,9 +4593,6 @@ \end{codeblock} \end{example} -\pnum -No other conversion can be performed using \keyword{static_cast}. - \rSec3[expr.reinterpret.cast]{Reinterpret cast} \pnum diff --git a/source/intro.tex b/source/intro.tex index 1928e84f43..dcf19acaa6 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -71,8 +71,8 @@ Language Specification}, Standard Ecma-262, third edition, 1999. \item -The Unicode Consortium. \doccite{The Unicode Standard}. -Available from: \url{https://www.unicode.org/versions/latest/} +The Unicode Consortium. \doccite{The Unicode Standard}, Version 15.1. +Available from: \url{https://www.unicode.org/versions/Unicode15.1.0/} \end{itemize} \indextext{references!normative|)} @@ -874,6 +874,11 @@ \ref{implimits} lists some quantities that can be subject to limitations and a potential minimum supported value for each quantity. +\pnum +A conforming implementation may use an implementation-defined version +of the Unicode Standard that is a later version than the one +referenced in \ref{intro.refs}. + \pnum A conforming implementation may have extensions (including additional library functions), provided they do not alter the diff --git a/source/lex.tex b/source/lex.tex index 28ce23f2b8..eb4f060959 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -588,16 +588,23 @@ the next preprocessing token is the longest sequence of characters that could constitute a preprocessing token, even if that would cause further lexical analysis to fail, -except that a \grammarterm{header-name}\iref{lex.header} is only formed +except that \begin{itemize} \item -after the \tcode{include} or \tcode{import} preprocessing token in a -\tcode{\#include}\iref{cpp.include} or -\tcode{import}\iref{cpp.import} directive, or - +a \grammarterm{header-name}\iref{lex.header} is only formed +\begin{itemize} \item -within a \grammarterm{has-include-expression}. - +immediately after the \tcode{include}, \tcode{embed}, or \tcode{import} preprocessing token in a +\tcode{\#include}\iref{cpp.include}, \tcode{\#embed}\iref{cpp.embed}, or +\tcode{import}\iref{cpp.import} directive, respectively, or +\item +immediately after a preprocessing token sequence of \xname{has_include} +or \xname{has_embed} immediately followed by \tcode{(} +in a \tcode{\#if}, \tcode{\#elif}, or \tcode{\#embed} directive\iref{cpp.cond,cpp.embed} and +\end{itemize} +\item +a \grammarterm{string-literal} token is never formed +when a \grammarterm{header-name} token can be formed. \end{itemize} \end{itemize} diff --git a/source/overloading.tex b/source/overloading.tex index c5691428c1..2bb867c346 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -2126,24 +2126,13 @@ defined for the purposes of \ref{over}; the actual initialization is defined in terms of constructors and is not a conversion. \end{note} -Any difference in top-level cv-qualification is -subsumed by the initialization itself and does not constitute a conversion. -\begin{example} -A parameter of type -\tcode{A} -can be initialized from an argument of type -\tcode{const A}. -The implicit conversion sequence for that case is the identity sequence; it -contains no ``conversion'' from -\tcode{const A} -to -\tcode{A}. -\end{example} \pnum -When the parameter has a class type and the argument expression has the -same type, the implicit conversion sequence is an identity conversion. +When the cv-unqualified version of the type of the argument expression +is the same as the parameter type, +the implicit conversion sequence is an identity conversion. When the parameter has a class type and the argument expression has a +(possibly cv-qualified) derived class type, the implicit conversion sequence is a derived-to-base \indextext{conversion!derived-to-base}% @@ -2153,6 +2142,14 @@ There is no such standard conversion; this derived-to-base conversion exists only in the description of implicit conversion sequences. \end{note} +\begin{example} +An implicit conversion sequence from an argument of type \tcode{const A} +to a parameter of type \tcode{A} can be formed, +even if overload resolution for copy-initialization of \tcode{A} +from the argument would not find a viable function\iref{over.match.ctor,over.match.viable}. +The implicit conversion sequence for that case is the identity sequence; it +contains no ``conversion'' from \tcode{const A} to \tcode{A}. +\end{example} \pnum When the parameter is the implicit object parameter of a static member function, diff --git a/source/preprocessor.tex b/source/preprocessor.tex index d5f6e0ba7d..2cbc5ab3a0 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -363,7 +363,8 @@ \indextext{\idxxname{has_embed}}% \begin{bnf} \nontermdef{has-embed-expression}\br - \terminal{\xname{has_embed}} \terminal{(} pp-balanced-token-seq \terminal{)} + \terminal{\xname{has_embed}} \terminal{(} header-name \opt{pp-balanced-token-seq} \terminal{)}\br + \terminal{\xname{has_embed}} \terminal{(} header-name-tokens \opt{pp-balanced-token-seq} \terminal{)} \end{bnf} \indextext{\idxxname{has_cpp_attribute}}% @@ -390,6 +391,8 @@ \grammarterm{has-attribute-expression}{s}, and/or \grammarterm{has-embed-expression}{s} as unary operator expressions. +A \grammarterm{defined-macro-expression} shall not appear +within a \grammarterm{has-include-expression} or \grammarterm{has-embed-expression}. \pnum A \grammarterm{defined-macro-expression} evaluates to \tcode{1} @@ -405,31 +408,26 @@ \tcode{\#undef} directive with the same subject identifier), \tcode{0} if it is not. -\pnum -The second form of \grammarterm{has-include-expression} -is considered only if the first form does not match, -in which case the preprocessing tokens are processed just as in normal text. - \pnum The header or source file identified by the parenthesized preprocessing token sequence in each contained \grammarterm{has-include-expression} is searched for as if that preprocessing token sequence -were the \grammarterm{pp-tokens} in a \tcode{\#include} directive, +were the \grammarterm{pp-tokens} of a \tcode{\#include} directive, except that no further macro expansion is performed. -If such a directive would not satisfy the syntactic requirements -of a \tcode{\#include} directive, the program is ill-formed. +If the preprocessing token sequence does not consist solely of a \grammarterm{header-name} +or cannot be combined\iref{cpp.include} into a single +\grammarterm{header-name} preprocessing token, the program is ill-formed. The \grammarterm{has-include-expression} evaluates to \tcode{1} if the search for the source file succeeds, and to \tcode{0} if the search fails. \pnum -The parenthesized \grammarterm{pp-balanced-token-seq} in each contained +The parenthesized preprocessing token sequence of each contained \grammarterm{has-embed-expression} is processed as if that -\grammarterm{pp-balanced-token-seq} were the \grammarterm{pp-tokens} in the -third form of a \tcode{\#embed} directive\iref{cpp.embed}. -If such a directive would not satisfy the syntactic requirements of a -\tcode{\#embed} directive, the program is ill-formed. +preprocessing token sequence were the \grammarterm{pp-tokens} +of a \tcode{\#embed} directive\iref{cpp.embed}, +except that no further macro expansion is performed. The \grammarterm{has-embed-expression} evaluates to: \begin{itemize} \item @@ -686,68 +684,74 @@ \indextext{\idxcode{\#include}}% \pnum -A -\tcode{\#include} -directive shall identify a header or source file -that can be processed by the implementation. +A \defnadj{header}{search} for a sequence of characters +searches a sequence of places for a header +identified uniquely by that sequence of characters. +How the places are determined or the header identified +is \impldef{determination of places and identification of headers during header search}. + +\pnum +A \defnadj{source file}{search} for a sequence of characters +attempts to identify a source file that is named by the sequence of characters. +The named source file is searched for +in an \impldef{search for source files during source file search} manner. +If the implementation does not support a source file search +for that sequence of characters, or if the search fails, +the result of the source file search +is the result of a header search for the same sequence of characters. \pnum A preprocessing directive of the form \begin{ncsimplebnf} -\terminal{\# include <} h-char-sequence \terminal{>} new-line +\terminal{\# include} header-name new-line \end{ncsimplebnf} -searches a sequence of -\impldef{sequence of places searched for a header} -places -for a header identified uniquely by the specified sequence -between the -\tcode{<} -and -\tcode{>} -delimiters, -and causes the replacement of that -directive by the entire contents of the header. -How the places are specified -or the header identified -is \impldef{search locations for \tcode{<>} header}. +causes the replacement of that directive by the entire contents +of the header or source file identified by \grammarterm{header-name}. \pnum -A preprocessing directive of the form +If the \grammarterm{header-name} is of the form \begin{ncsimplebnf} -\terminal{\# include "} q-char-sequence \terminal{"} new-line +\terminal{<} h-char-sequence \terminal{>} \end{ncsimplebnf} -causes the replacement of that -directive by the entire contents of the -source file identified by the specified sequence between the -\tcode{"} -delimiters. -The named source file is searched for in an -\impldef{manner of search for included source file} -manner. -If this search is not supported, -or if the search fails, -the directive is reprocessed as if it read +a header is identified by a header search for the sequence of characters +of the \grammarterm{h-char-sequence}. + +\pnum +If the \grammarterm{header-name} is of the form \begin{ncsimplebnf} -\terminal{\# include <} h-char-sequence \terminal{>} new-line +\terminal{"} q-char-sequence \terminal{"} \end{ncsimplebnf} -with the identical contained sequence (including -\tcode{>} -characters, if any) from the original directive. +the source file or header is identified by a source file search +for the sequence of characters of the \grammarterm{q-char-sequence}. + +\pnum +If a header search fails, or if a source file search or header search +identifies a header or source file that cannot be processed by the implementation, +the program is ill-formed. +\begin{note} +If the header or source file cannot be processed, +the program is ill-formed even when evaluating \xname{has_include}. +\end{note} \pnum A preprocessing directive of the form \begin{ncsimplebnf} \terminal{\# include} pp-tokens new-line \end{ncsimplebnf} -(that does not match one of the two previous forms) is permitted. +(that does not match the previous form) is permitted. The preprocessing tokens after \tcode{include} in the directive are processed just as in normal text (i.e., each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens). -If the directive resulting after all replacements does not match -one of the two previous forms, the behavior is -undefined. +Then, an attempt is made to form a \grammarterm{header-name} +preprocessing token\iref{lex.header} from the whitespace and the characters +of the spellings of the resulting sequence of preprocessing tokens; +the treatment of whitespace +is \impldef{treatment of whitespace when processing a \tcode{\#include} directive}. +If the attempt succeeds, the directive with the so-formed \grammarterm{header-name} +is processed as specified for the previous form. +Otherwise, the behavior is undefined. \begin{note} Adjacent \grammarterm{string-literal}s are not concatenated into a single \grammarterm{string-literal} @@ -755,14 +759,6 @@ thus, an expansion that results in two \grammarterm{string-literal}s is an invalid directive. \end{note} -The method by which a sequence of preprocessing tokens between a -\tcode{<} -and a -\tcode{>} -preprocessing token pair or a pair of -\tcode{"} -characters is combined into a single header name -preprocessing token is \impldef{search locations for \tcode{""""} header}. \pnum The implementation shall provide unique mappings for @@ -838,35 +834,58 @@ \rSec2[cpp.embed.gen]{General} +\pnum +A \defnadj{bracket resource}{search} for a sequence of characters +searches a sequence of places for a resource identified uniquely +by that sequence of characters. +How the places are determined or the resource identified +is \impldef{determination of places and identification of resources during bracket resource search}. + +\pnum +A \defnadj{quote resource}{search} for a sequence of characters +attempts to identify a resource that is named by the sequence of characters. +The named resource is searched for +in an \impldef{search for resources during quote resource search} manner. +If the implementation does not support a quote resource search +for that sequence of characters, or if the search fails, +the result of the quote resource search +is the result of a bracket resource search for the same sequence of characters. + \pnum A preprocessing directive of the form \begin{ncsimplebnf} -\terminal{\# embed <} h-char-sequence \terminal{>} \opt{pp-tokens} new-line +\terminal{\# embed} header-name \opt{pp-tokens} new-line \end{ncsimplebnf} -searches a sequence of -\impldef{sequence of places searched for an embedded resource} -places for a resource identified uniquely by the specified sequence between -the \tcode{<} and \tcode{>} delimiters. -How the places are specified or the resource identified is -\impldef{search locations for embedded resources specified with \tcode{<>}}. +causes the replacement of that directive +by preprocessing tokens derived from data +in the resource identified by \grammarterm{header-name}, +as specified below. \pnum -A preprocessing directive of the form +If the \grammarterm{header-name} is of the form \begin{ncsimplebnf} -\terminal{\# embed "} q-char-sequence \terminal{"} \opt{pp-tokens} new-line +\terminal{<} h-char-sequence \terminal{>} \end{ncsimplebnf} -searches for a resource identified by the specified sequence between the -\tcode{"} delimiters. -The named resource is searched for in an -\impldef{manner of search for named resource} -manner. -If this search is not supported, or if the search fails, the directive is -reprocessed as if it read +the resource is identified by a bracket resource search +for the sequence of characters of the \grammarterm{h-char-sequence}. + +\pnum +If the \grammarterm{header-name} is of the form \begin{ncsimplebnf} -\terminal{\# embed <} h-char-sequence \terminal{>} \opt{pp-tokens} new-line +\terminal{"} q-char-sequence \terminal{"} \end{ncsimplebnf} -with the identical contained sequence (including \tcode{>} characters, if any) -from the original directive. +the resource is identified by a quote resource search +for the sequence of characters of the \grammarterm{q-char-sequence}. + +\pnum +If a bracket resource search fails, +or if a quote or bracket resource search identifies a resource +that cannot be processed by the implementation, the program is ill-formed. +\begin{note} +If the resource cannot be processed, the program is ill-formed +even when processing \tcode{\#embed} with \tcode{limit(0)}\iref{cpp.embed.param.limit} +or evaluating \xname{has_embed}. +\end{note} \pnum \recommended A mechanism similar to, but distinct from, the @@ -987,63 +1006,60 @@ \begin{ncsimplebnf} \terminal{\# embed} pp-tokens new-line \end{ncsimplebnf} -(that does not match one of the two previous forms) is permitted. +(that does not match the previous form) is permitted. The preprocessing tokens after \tcode{embed} in the directive are processed just as in normal text (i.e., each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens). -The directive resulting after all replacements of the third form shall match -one of the two previous forms. +Then, an attempt is made to form a \grammarterm{header-name} +preprocessing token\iref{lex.header} from the whitespace and the characters +of the spellings of the resulting sequence of preprocessing tokens immediately after embed; +the treatment of whitespace +is \impldef{treatment of whitespace when processing a \tcode{\#embed} directive}. +If the attempt succeeds, the directive with the so-formed \grammarterm{header-name} +is processed as specified for the previous form. +Otherwise, the program is ill-formed. \begin{note} Adjacent \grammarterm{string-literal}{s} are not concatenated into a single \grammarterm{string-literal} (see the translation phases in \iref{lex.phases}); thus, an expansion that results in two \grammarterm{string-literal}{s} is an invalid directive. \end{note} - -Any further processing as in normal text described for the two previous -forms is not performed. +Any further processing as in normal text described for the previous +form is not performed. \begin{note} That is, processing as in normal text happens once and only once for the entire directive. \end{note} - \begin{example} -If the directive matches the third form, the whole directive is replaced. -If the directive matches the first two forms, everything after the name is -replaced. - +If the directive matches the second form, the whole directive is replaced. +If the directive matches the first form, everything after the name is replaced. \begin{codeblock} -#define prefix(ARG) suffix(ARG) -#define THE_ADDITION "teehee" -#define THE_RESOURCE ":3c" -#embed ":3c" prefix(THE_ADDITION) -#embed THE_RESOURCE prefix(THE_ADDITION) +#define EMPTY +#define X myfile +#define Y rsc +#define Z 42 +#embed prefix(Z) +#embed EMPTY prefix(Z) \end{codeblock} - is equivalent to: - \begin{codeblock} -#embed ":3c" suffix("teehee") -#embed ":3c" suffix("teehee") +#embed prefix(42) +#embed prefix(42) \end{codeblock} \end{example} -\pnum -The method by which a sequence of preprocessing tokens between a \tcode{<} and -a \tcode{>} preprocessing token pair or a pair of \tcode{"} characters is -combined into a single resource name preprocessing token is -\impldef{search locations for \tcode{""""} resource}. - \rSec2[cpp.embed.param]{Embed parameters} + \rSec3[cpp.embed.param.limit]{limit parameter} + \pnum An \grammarterm{embed-parameter} of the form \tcode{limit (} \grammarterm{pp-balanced-token-seq} \tcode{)} specifies the maximum possible number of elements in the comma-delimited list. It shall appear at most once in the \grammarterm{embed-parameter-seq}. -The token \tcode{defined} shall not appear in the -\grammarterm{constant-expression}. +The preprocessing token \tcode{defined} shall not appear in the +\grammarterm{pp-balanced-token-seq}. \pnum The \grammarterm{pp-balanced-token-seq} is evaluated as a @@ -1783,17 +1799,15 @@ Otherwise, the original spelling of each preprocessing token in the stringizing argument is retained in the character string literal, except for special handling for producing the spelling of -\grammarterm{string-literal}s and \grammarterm{character-literal}s: -a -\tcode{\textbackslash} -character is inserted before each -\tcode{"} -and -\tcode{\textbackslash} -character of a \grammarterm{character-literal} or \grammarterm{string-literal} -(including the delimiting -\tcode{"} -characters). +\grammarterm{header-name}s, +\grammarterm{string-literal}s, +and \grammarterm{character-literal}s: +a \tcode{\textbackslash} character is inserted before each +\tcode{"} and \tcode{\textbackslash} character of a +\grammarterm{header-name}, +\grammarterm{character-literal}, +or \grammarterm{string-literal} +(including the delimiting \tcode{"} characters). If the replacement that results is not a valid character string literal, the behavior is undefined. The character string literal corresponding to an empty stringizing argument is \tcode{""}. diff --git a/source/templates.tex b/source/templates.tex index 7d4eca1376..fd95369aaa 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -8700,6 +8700,8 @@ \item A \grammarterm{pack-index-specifier} or a \grammarterm{pack-index-expression}. \item +A \grammarterm{type-constraint}. +\item The \grammarterm{expression} of a \grammarterm{decltype-specifier}. \item A constant template argument or an array bound in which a subexpression diff --git a/source/uax31.tex b/source/uax31.tex index 641ab63b11..79f0f7d0e9 100644 --- a/source/uax31.tex +++ b/source/uax31.tex @@ -48,17 +48,6 @@ \grammarterm{identifier-start} or \grammarterm{identifier} followed by \grammarterm{identifier-continue}. -\rSec2[uaxid.def.rfmt]{R1a Restricted format characters} - -\pnum -If an implementation of \UAX{31} wishes to allow format characters -such as \unicode{200d}{zero width joiner} or \unicode{200c}{zero width non-joiner} -it must define a profile allowing them, or -describe precisely which combinations are permitted. - -\pnum -\Cpp{} does not allow format characters in identifiers, so this does not apply. - \rSec2[uaxid.def.stable]{R1b Stable identifiers} \pnum diff --git a/source/xrefdelta.tex b/source/xrefdelta.tex index 45f98073b4..cd831456cc 100644 --- a/source/xrefdelta.tex +++ b/source/xrefdelta.tex @@ -451,6 +451,9 @@ \removedxref{type.index.members} \removedxref{type.index.hash} +% CWG 2843 removed [uaxid.def.rfmt] +\removedxref{uaxid.def.rfmt} + %%% Renamed sections. %%% Examples: % diff --git a/source/xrefprev b/source/xrefprev index 65de28a389..c59156d80d 100644 --- a/source/xrefprev +++ b/source/xrefprev @@ -2594,6 +2594,7 @@ type.index.overview type.index.synopsis type.info typeinfo.syn +uaxid.def.rfmt uncaught.exceptions underflow.error uninitialized.construct.default