From 73e6941ed0fb80b90e86ef722856db1ff5495e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Sun, 15 Oct 2023 01:18:17 +0100 Subject: [PATCH 001/181] Update configuration for building working drafts after N4964. --- source/config.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/config.tex b/source/config.tex index 40e1c26954..3867bcb2bd 100644 --- a/source/config.tex +++ b/source/config.tex @@ -1,8 +1,8 @@ %!TEX root = std.tex %%-------------------------------------------------- %% Version numbers -\newcommand{\docno}{N4964} -\newcommand{\prevdocno}{N4958} +\newcommand{\docno}{Dxxxx} +\newcommand{\prevdocno}{N4964} \newcommand{\cppver}{202302L} %% Release date From a27ede64fef7fda551d480e5a1cf1b9a73832574 Mon Sep 17 00:00:00 2001 From: "S. B. Tam" Date: Tue, 24 Oct 2023 20:55:27 +0800 Subject: [PATCH 002/181] [span.cons] Add `std::` for `data(arr)` (#6632) --- source/containers.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 00e07cefd0..59df542c1f 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -18450,7 +18450,7 @@ \begin{itemdescr} \pnum \constraints -Let \tcode{U} be \tcode{remove_pointer_t}. +Let \tcode{U} be \tcode{remove_pointer_t}. \begin{itemize} \item \tcode{extent == dynamic_extent || N == extent} is \tcode{true}, and \item \tcode{is_convertible_v} is \tcode{true}. @@ -18469,7 +18469,7 @@ \pnum \ensures -\tcode{size() == N \&\& data() == data(arr)} is \tcode{true}. +\tcode{size() == N \&\& data() == std::data(arr)} is \tcode{true}. \end{itemdescr} \indexlibraryctor{span}% From 84c526ebbda74553bf935f35f5594b8d5591bce5 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Mon, 30 Oct 2023 14:22:57 -0700 Subject: [PATCH 003/181] [format.formatter.spec] Add missing include to example (#6636) The example code refers to `std::string` directly so it should `#include`. --- source/utilities.tex | 1 + 1 file changed, 1 insertion(+) diff --git a/source/utilities.tex b/source/utilities.tex index 154e787edb..b603afcc3a 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -16981,6 +16981,7 @@ \begin{example} \begin{codeblock} #include +#include enum color { red, green, blue }; const char* color_names[] = { "red", "green", "blue" }; From 87c8407416153d95d70f602a1b80f4d63c7e61b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Wed, 1 Nov 2023 14:15:16 +0000 Subject: [PATCH 004/181] [dcl.pre] Fix spacing --- source/declarations.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 8951eb2715..e928b96a28 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -331,8 +331,8 @@ } void g(char c) { - f(0); // OK - f(c); // error on implementations where \tcode{sizeof(int) > 1}: must be \tcode{int}-sized + f(0); // OK + f(c); // error on implementations where \tcode{sizeof(int) > 1}: must be \tcode{int}-sized } \end{codeblock} \end{example} From 4a6f2e3f4791c44b8c8f32a75d0bebac4a7b6a9e Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 2 Nov 2023 00:53:04 +0100 Subject: [PATCH 005/181] [intro.refs] Move nicknames for standards to relevant subclauses --- source/intro.tex | 8 -------- source/lib-intro.tex | 4 ++++ source/regex.tex | 4 ++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/intro.tex b/source/intro.tex index b241e4fd36..32a759094d 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -69,14 +69,6 @@ The Unicode Consortium. \doccite{The Unicode Standard}. Available from: \url{https://www.unicode.org/versions/latest/} \end{itemize} - -\pnum -The operating system interface described in ISO/IEC 9945:2009 is -hereinafter called \defn{POSIX}. - -\pnum -The ECMAScript Language Specification described in Standard Ecma-262 is -hereinafter called \defn{ECMA-262}. \indextext{references!normative|)} \rSec0[intro.defs]{Terms and definitions} diff --git a/source/lib-intro.tex b/source/lib-intro.tex index fb8f7eee5a..9adcc68775 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -45,6 +45,10 @@ \ref{thread} & Concurrency support library \\ \end{floattable} +\pnum +The operating system interface described in ISO/IEC/IEEE 9945:2009 is +hereinafter called \defn{POSIX}. + \pnum The language support library\iref{support} provides components that are required by certain parts of the \Cpp{} language, diff --git a/source/regex.tex b/source/regex.tex index eb015cc6ed..5548adfea4 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -33,6 +33,10 @@ \ref{re.grammar} & Grammar & \\ \end{libsumtab} +\pnum +The ECMAScript Language Specification described in Standard Ecma-262 +is called \defn{ECMA-262} in this Clause. + \rSec1[re.req]{Requirements} \pnum From dc6eed02986d9c3c6827c710adb577ba0809f939 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 7 Nov 2023 04:32:19 -0500 Subject: [PATCH 006/181] [dcl.dcl, over.best.ics, temp.param, class.union.anon] Remove mentions of "storage class" (#3906) --- source/classes.tex | 11 ++++++----- source/declarations.tex | 4 ++-- source/overloading.tex | 2 +- source/templates.tex | 5 ++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index bfb2b24787..fd6e7ffb8b 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -3257,11 +3257,12 @@ \pnum \indextext{\idxcode{union}!global anonymous}% \indextext{scope!anonymous \tcode{union} at namespace}% -Anonymous unions declared in the scope of a namespace with external linkage -shall be declared \keyword{static}. Anonymous unions declared at -block scope shall be declared with any storage class allowed for a -block variable, or with no storage class. A storage class is not -allowed in a declaration of an anonymous union in a class scope. +An anonymous union declared in the scope of a namespace with external linkage +shall use the \grammarterm{storage-class-specifier} \keyword{static}. +Anonymous unions declared at block scope shall not use a \grammarterm{storage-class-specifier} +that is not permitted in the declaration of a block variable. +An anonymous union declaration at class scope shall not have +a \grammarterm{storage-class-specifier}. \pnum \begin{note} diff --git a/source/declarations.tex b/source/declarations.tex index e928b96a28..50d26e6a3d 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -2162,7 +2162,7 @@ it is as if a unique identifier were included in the appropriate place\iref{dcl.name}. The preceding specifiers indicate -the type, storage class or other properties +the type, storage duration, linkage, or other properties of the entity or entities being declared. Each declarator specifies one entity and (optionally) names it and/or @@ -8483,7 +8483,7 @@ \keyword{extern} specifier\iref{dcl.stc} for the purpose of determining the linkage of the declared name and whether it is a definition. Such a declaration shall -not specify a storage class. +not have a \grammarterm{storage-class-specifier}. \begin{example} \begin{codeblock} extern "C" double f(); diff --git a/source/overloading.tex b/source/overloading.tex index 2c02f343f8..f357452fa6 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -2001,7 +2001,7 @@ are converted to match the corresponding properties of the parameter. \begin{note} -Other properties, such as the lifetime, storage class, +Other properties, such as the lifetime, storage duration, linkage, alignment, accessibility of the argument, whether the argument is a bit-field, and whether a function is deleted\iref{dcl.fct.def.delete}, are ignored. So, although an implicit diff --git a/source/templates.tex b/source/templates.tex index 1950689f30..9c50c139eb 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -306,9 +306,8 @@ called \tcode{T}, rather than an unnamed non-type \grammarterm{template-parameter} of class \tcode{T}. \end{example} -A storage class shall not be specified in a -\grammarterm{template-parameter} -declaration. +A \grammarterm{template-parameter} declaration shall not +have a \grammarterm{storage-class-specifier}. Types shall not be defined in a \grammarterm{template-parameter} declaration. From 17c09925b2423c596196d3f88a61ff7b4052ef7a Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 7 Nov 2023 01:16:28 -0500 Subject: [PATCH 007/181] [class.conv.fct] Fix reference to 'ref-qualifier-seq' --- source/classes.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/classes.tex b/source/classes.tex index fd6e7ffb8b..4ec1a5409e 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -2438,7 +2438,7 @@ a function declarator\iref{dcl.fct} of the form \begin{ncsimplebnf} ptr-declarator \terminal{(} parameter-declaration-clause \terminal{)} \opt{cv-qualifier-seq}\br -\bnfindent \opt{ref-qualifier-seq} \opt{noexcept-specifier} \opt{attribute-specifier-seq} +\bnfindent \opt{ref-qualifier} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \end{ncsimplebnf} where the \grammarterm{ptr-declarator} consists solely of an \grammarterm{id-expression}, From 90720a35b0c3d65488d9dc9ecea682c271f43d52 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 30 Oct 2023 09:34:01 +0800 Subject: [PATCH 008/181] [queue.syn] Show `formatter` specializations in the synopsis --- source/containers.tex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/containers.tex b/source/containers.tex index 59df542c1f..f9aac13da4 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -13682,6 +13682,10 @@ template struct uses_allocator, Alloc>; + // \ref{container.adaptors.format}, formatter specialization for \tcode{queue} + template Container> + struct formatter, charT>; + // \ref{priority.queue}, class template \tcode{priority_queue} template, class Compare = less> @@ -13692,6 +13696,10 @@ priority_queue& y) noexcept(noexcept(x.swap(y))); template struct uses_allocator, Alloc>; + + // \ref{container.adaptors.format}, formatter specialization for \tcode{priority_queue} + template Container, class Compare> + struct formatter, charT>; } \end{codeblock} From e43aa89a4882f8080fb10c843cdb25c9740b65c7 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 30 Oct 2023 09:36:24 +0800 Subject: [PATCH 009/181] [stack.syn] Show the `formatter` specialization in the synopsis --- source/containers.tex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/containers.tex b/source/containers.tex index f9aac13da4..7da59c8155 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -13734,6 +13734,10 @@ void swap(stack& x, stack& y) noexcept(noexcept(x.swap(y))); template struct uses_allocator, Alloc>; + + // \ref{container.adaptors.format}, formatter specialization for \tcode{stack} + template Container> + struct formatter, charT>; } \end{codeblock} From b5d3b3c78a72554e13657c5542c3d98f5b7fa42d Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Sat, 21 Oct 2023 20:41:48 +0200 Subject: [PATCH 010/181] [std] Use more \defnadj --- source/basic.tex | 3 +-- source/classes.tex | 5 ++--- source/statements.tex | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index 65947ad304..ed92d9bb77 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3816,7 +3816,6 @@ \rSec3[basic.stc.static]{Static storage duration} \pnum -\indextext{storage duration!static}% All variables which \begin{itemize} \item @@ -3826,7 +3825,7 @@ are first declared with the \keyword{static} or \keyword{extern} keywords\iref{dcl.stc} \end{itemize} -have \defn{static storage duration}. +have \defnadj{static}{storage duration}. The storage for these entities lasts for the duration of the program\iref{basic.start.static,basic.start.term}. diff --git a/source/classes.tex b/source/classes.tex index 4ec1a5409e..85a4b646e4 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -63,7 +63,7 @@ a partial specialization\iref{temp.spec.partial}. A \grammarterm{class-specifier} whose \grammarterm{class-head} omits the -\grammarterm{class-head-name} defines an unnamed class. +\grammarterm{class-head-name} defines an \defnadj{unnamed}{class}. \begin{note} An unnamed class thus can't be \tcode{final}. @@ -2779,9 +2779,8 @@ \end{note} \pnum -\indextext{bit-field!unnamed}% A declaration for a bit-field that omits the \grammarterm{identifier} -declares an \defn{unnamed bit-field}. Unnamed bit-fields are not +declares an \defnadj{unnamed}{bit-field}. Unnamed bit-fields are not members and cannot be initialized. An unnamed bit-field shall not be declared with a cv-qualified type. \begin{note} diff --git a/source/statements.tex b/source/statements.tex index 4f0c773c51..4c8bef837e 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -187,10 +187,9 @@ \indextext{side effects}% side effects from an expression statement are completed before the next statement is executed. -\indextext{statement!null}% \indextext{statement!empty}% An expression statement with the expression missing is called -a \defn{null statement}. +a \defnadj{null}{statement}. \begin{note} Most statements are expression statements --- usually assignments or function calls. A null statement is useful to supply a null body to an From 80a8748fd401cfceee804bc96d2bfc518726d2e7 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Thu, 12 Oct 2023 18:24:21 -0400 Subject: [PATCH 011/181] [class.copy.assign] Remove a superfluous note. Alternatively we could have added the word "non-object"; or changed it to say "An overloaded assignment operator must be a member function"; but it doesn't seem like it needs to be here at all. --- source/classes.tex | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 85a4b646e4..08952bf640 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -1746,11 +1746,6 @@ one non-object parameter of type \tcode{X\&\&}, \tcode{const X\&\&}, \tcode{volatile X\&\&}, or \tcode{const volatile X\&\&}. \begin{note} -An overloaded assignment operator must be -declared to have only one parameter; see~\ref{over.ass}. -\end{note} -{} -\begin{note} More than one form of move assignment operator can be declared for a class. \end{note} From c9c69dc54052badeb9b80458027371438d886763 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Thu, 12 Oct 2023 18:58:39 -0400 Subject: [PATCH 012/181] [class.copy.assign] Add some missing "non-object"s --- source/classes.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 08952bf640..ec01f6920d 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -1679,7 +1679,7 @@ \begin{note} If a class \tcode{X} -only has a copy assignment operator with a parameter of type +only has a copy assignment operator with a non-object parameter of type \tcode{X\&}, an expression of type const \tcode{X} @@ -1719,12 +1719,12 @@ \begin{itemize} \item each direct base class \tcode{B} of \tcode{X} -has a copy assignment operator whose parameter is of type +has a copy assignment operator whose non-object parameter is of type \tcode{const B\&}, \tcode{const volatile B\&}, or \tcode{B}, and \item for all the non-static data members of \tcode{X} that are of a class type \tcode{M} (or array thereof), -each such class type has a copy assignment operator whose parameter is of type +each such class type has a copy assignment operator whose non-object parameter is of type \tcode{const M\&}, \tcode{const volatile M\&}, or \tcode{M}. \begin{footnote} From 2b5fc2936f12f73e975dbb9f34d3790fe0aa708f Mon Sep 17 00:00:00 2001 From: Matt Bentley Date: Wed, 8 Nov 2023 14:56:22 +1300 Subject: [PATCH 013/181] [sequence.reqmts] Remove misleading, oversimplified informative text --- source/containers.tex | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 7da59c8155..0e8727daba 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -1253,24 +1253,6 @@ \tcode{flat_multiset}s, out of the basic sequence container kinds (or out of other program-defined sequence containers). -\pnum -\begin{note} -The sequence containers -offer the programmer different complexity trade-offs. -\tcode{vector} -is appropriate in most circumstances. -\tcode{array} -has a fixed size known during translation. -\tcode{list} or \tcode{forward_list} -support frequent insertions and deletions from the -middle of the sequence. -\tcode{deque} -supports efficient insertions and deletions taking place at the beginning or at the -end of the sequence. -When choosing a container, remember \tcode{vector} is best; -leave a comment to explain if you choose from the rest! -\end{note} - \pnum In this subclause, \begin{itemize} From 11334c71244a046f0c29b01dfd79b35f6fea8cc4 Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Fri, 1 Sep 2023 09:29:01 +0200 Subject: [PATCH 014/181] [class.copy.elision] improve reference and replace informal term --- source/classes.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index ec01f6920d..9f7bf638a0 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -6227,8 +6227,8 @@ corresponding parameter if the meaning of the program will be unchanged except for the execution of a constructor and destructor for the parameter copy object -\item when the \grammarterm{exception-declaration} of an -exception handler\iref{except.pre} declares an object of the same +\item when the \grammarterm{exception-declaration} of a +\grammarterm{handler}\iref{except.handle} declares an object of the same type (except for cv-qualification) as the exception object\iref{except.throw}, the copy operation can be omitted by treating the \grammarterm{exception-declaration} as an alias for the exception From 4feefb62e0419bb52c678389163729959785d44a Mon Sep 17 00:00:00 2001 From: Jan Schultke Date: Wed, 8 Nov 2023 02:59:01 +0100 Subject: [PATCH 015/181] [mem.res.pool.options] Change "field" to "member" (#6479) --- source/memory.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/memory.tex b/source/memory.tex index 890f431d45..8e194e19e8 100644 --- a/source/memory.tex +++ b/source/memory.tex @@ -6310,7 +6310,7 @@ is greater than an \impldef{largest supported value to configure the maximum number of blocks to replenish a pool} limit, that limit is used instead. The implementation -may choose to use a smaller value than is specified in this field and +may choose to use a smaller value than is specified in this member and may use different values for different pools. \end{itemdescr} @@ -6329,7 +6329,7 @@ is greater than an \impldef{largest supported value to configure the largest allocation satisfied directly by a pool} limit, that limit is used instead. The implementation may choose a pass-through threshold -larger than specified in this field. +larger than specified in this member. \end{itemdescr} \rSec3[mem.res.pool.ctor]{Constructors and destructors} From a700e3b87b00d2673b3cded0a61201d09dfc051a Mon Sep 17 00:00:00 2001 From: "S. B. Tam" Date: Wed, 8 Nov 2023 10:01:46 +0800 Subject: [PATCH 016/181] [version.syn] Bump value of __cpp_lib_constexpr_complex (#6421) P1383R2 "More constexpr for and " modifies two headers; both __cpp_lib_constexpr_cmath and __cpp_lib_constexpr_complex should be updated. This aligns with existing practice in SD6. --- source/support.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/support.tex b/source/support.tex index 5d76edc882..4360c21e2c 100644 --- a/source/support.tex +++ b/source/support.tex @@ -602,7 +602,7 @@ #define @\defnlibxname{cpp_lib_constexpr_bitset}@ 202207L // also in \libheader{bitset} #define @\defnlibxname{cpp_lib_constexpr_charconv}@ 202207L // also in \libheader{charconv} #define @\defnlibxname{cpp_lib_constexpr_cmath}@ 202306L // also in \libheader{cmath}, \libheader{cstdlib} -#define @\defnlibxname{cpp_lib_constexpr_complex}@ 201711L // also in \libheader{complex} +#define @\defnlibxname{cpp_lib_constexpr_complex}@ 202306L // also in \libheader{complex} #define @\defnlibxname{cpp_lib_constexpr_dynamic_alloc}@ 201907L // also in \libheader{memory} #define @\defnlibxname{cpp_lib_constexpr_functional}@ 201907L // freestanding, also in \libheader{functional} #define @\defnlibxname{cpp_lib_constexpr_iterator}@ 201811L // freestanding, also in \libheader{iterator} From e9fb04e1c1e67bfb07bf3c61145b9d63a0f0adcf Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Tue, 27 Sep 2022 15:36:08 -0400 Subject: [PATCH 017/181] [dcl.enum] Enumerators don't have "initializers" --- source/declarations.tex | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 50d26e6a3d..8fe7cac829 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -7101,12 +7101,11 @@ An \grammarterm{enumerator-definition} with \tcode{=} gives the associated \grammarterm{enumerator} the value indicated by the \grammarterm{constant-expression}. -If the first \grammarterm{enumerator} -has no \grammarterm{initializer}, the value of the corresponding constant -is zero. An \grammarterm{enumerator-definition} without an -\grammarterm{initializer} gives the \grammarterm{enumerator} the value -obtained by increasing the value of the previous \grammarterm{enumerator} -by one. +An \grammarterm{enumerator-definition} without \tcode{=} gives the associated +\grammarterm{enumerator} the value zero +if it is the first \grammarterm{enumerator-definition}, +and the value of the previous \grammarterm{enumerator} +increased by one otherwise. \begin{example} \begin{codeblock} enum { a, b, c=0 }; From bc3cb41a36dfff0d2358f4e294be9636590e680e Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 7 Nov 2023 21:08:15 -0500 Subject: [PATCH 018/181] [dcl.name] Turn informative wording into note (#3964) --- source/declarations.tex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 8fe7cac829..f1a7bcdbb9 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -2402,8 +2402,11 @@ \end{example} \pnum -A type can also be named (often more easily) by using a -\tcode{typedef}\iref{dcl.typedef}. +\begin{note} +A type can also be named by a \grammarterm{typedef-name}, +which is introduced by a typedef declaration +or \grammarterm{alias-declaration}\iref{dcl.typedef}. +\end{note} \rSec2[dcl.ambig.res]{Ambiguity resolution}% \indextext{ambiguity!declaration versus cast}% From 82b2ba6f6245e717cb002a9a836117a918aab36a Mon Sep 17 00:00:00 2001 From: Patrick Johnston Date: Wed, 8 Nov 2023 02:10:58 +0000 Subject: [PATCH 019/181] [streambuf.general] Remove incorrect "abstract" The referenced class template `basic_streambuf` is not abstract. --- source/iostreams.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/iostreams.tex b/source/iostreams.tex index 7e1b661fdb..4de815cac6 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -3096,7 +3096,7 @@ \pnum The class template \tcode{basic_streambuf} -serves as an abstract base class for deriving various +serves as a base class for deriving various \term{stream buffers} whose objects each control two \term{character sequences}: From bbaa4a497e03d944fc38279db4d8c47eed7831d9 Mon Sep 17 00:00:00 2001 From: Jan Schultke Date: Thu, 12 Oct 2023 20:51:57 +0200 Subject: [PATCH 020/181] [basic.lval] turn reference paragraph into note --- source/expressions.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/expressions.tex b/source/expressions.tex index 3229ed4d8b..312577c84e 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -272,9 +272,11 @@ applied to convert the expression to an xvalue. \pnum +\begin{note} The discussion of reference initialization in~\ref{dcl.init.ref} and of temporaries in~\ref{class.temporary} indicates the behavior of lvalues and rvalues in other significant contexts. +\end{note} \pnum Unless otherwise indicated\iref{dcl.type.decltype}, From a03b8b70d6666b67d27c801b68d41683e987e929 Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Thu, 5 Oct 2023 15:27:29 -0400 Subject: [PATCH 021/181] [temp.param] Introduce term to xref structural type The current cross-references to [temp.param] appear confusing, as the structural type definition is buried a couple of pages below. Also, this change looks clearer in the source. --- source/containers.tex | 2 +- source/expressions.tex | 2 +- source/templates.tex | 1 + source/utilities.tex | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 0e8727daba..45251b0de2 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -6188,7 +6188,7 @@ for operations where there is additional semantic information. \pnum -\tcode{array} is a structural type\iref{temp.param} if +\tcode{array} is a structural type\iref{term.structural.type} if \tcode{T} is a structural type. Two values \tcode{a1} and \tcode{a2} of type \tcode{array} are template-argument-equivalent\iref{temp.type} if and only if diff --git a/source/expressions.tex b/source/expressions.tex index 312577c84e..6933e50669 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -1877,7 +1877,7 @@ \pnum The closure type is not an aggregate type\iref{dcl.init.aggr} and -not a structural type\iref{temp.param}. +not a structural type\iref{term.structural.type}. An implementation may define the closure type differently from what is described below provided this does not alter the observable behavior of the program other than by changing: diff --git a/source/templates.tex b/source/templates.tex index 9c50c139eb..f107d82813 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -391,6 +391,7 @@ are ignored when determining its type. \pnum +\label{term.structural.type}% A \defnadj{structural}{type} is one of the following: \begin{itemize} \item a scalar type, or diff --git a/source/utilities.tex b/source/utilities.tex index b603afcc3a..215b5ccf21 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -797,7 +797,7 @@ is \tcode{true}, then the destructor of \tcode{pair} is trivial. \pnum -\tcode{pair} is a structural type\iref{temp.param} +\tcode{pair} is a structural type\iref{term.structural.type} if \tcode{T} and \tcode{U} are both structural types. Two values \tcode{p1} and \tcode{p2} of type \tcode{pair} are template-argument-equivalent\iref{temp.type} if and only if From 71ee18ab8cd9efca0d8afa1f6e639cb02610a52b Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Tue, 7 Nov 2023 16:18:40 -1000 Subject: [PATCH 022/181] [basic.types.general] Introduce term to xref implicit-lifetime type (#6591) --- source/basic.tex | 3 ++- source/memory.tex | 2 +- source/meta.tex | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index ed92d9bb77..a2693df061 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3338,7 +3338,7 @@ within a specified region of storage. For each operation that is specified as implicitly creating objects, that operation implicitly creates and starts the lifetime of -zero or more objects of implicit-lifetime types\iref{basic.types.general} +zero or more objects of implicit-lifetime types\iref{term.implicit.lifetime.type} in its specified region of storage if doing so would result in the program having defined behavior. If no such set of objects would give the program defined behavior, @@ -4833,6 +4833,7 @@ types\iref{class.prop}, arrays of such types, and cv-qualified versions of these types are collectively called \defnadjx{standard-layout}{types}{type}. +\label{term.implicit.lifetime.type}% Scalar types, implicit-lifetime class types\iref{class.prop}, array types, and cv-qualified versions of these types are collectively called \defnadjx{implicit-lifetime}{types}{type}. diff --git a/source/memory.tex b/source/memory.tex index 8e194e19e8..d3bc9c6071 100644 --- a/source/memory.tex +++ b/source/memory.tex @@ -881,7 +881,7 @@ \begin{itemdescr} \pnum \mandates -\tcode{T} is an implicit-lifetime type\iref{basic.types.general} +\tcode{T} is an implicit-lifetime type\iref{term.implicit.lifetime.type} and not an incomplete type\iref{term.incomplete.type}. \pnum diff --git a/source/meta.tex b/source/meta.tex index 27a2b7b868..90c9ab892a 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -1209,7 +1209,7 @@ \indexlibraryglobal{is_implicit_lifetime}% \tcode{template}\br \tcode{struct is_implicit_lifetime;} & - \tcode{T} is an implicit-lifetime type\iref{basic.types.general}. & + \tcode{T} is an implicit-lifetime type\iref{term.implicit.lifetime.type}. & \tcode{T} shall be an array type, a complete type, or \cv{}~\keyword{void}. \\ \rowsep From ad839a08cd01463dfcabad851f89bc0d5226d3d0 Mon Sep 17 00:00:00 2001 From: Jan Schultke Date: Wed, 8 Nov 2023 03:26:46 +0100 Subject: [PATCH 023/181] [class.conv.ctor] Add a space (#6497) --- source/classes.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/classes.tex b/source/classes.tex index 9f7bf638a0..fb32d78051 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -2351,7 +2351,7 @@ \begin{codeblock} struct X { X(int); - X(const char*, int =0); + X(const char*, int = 0); X(int, int); }; From 21454c7ebf67a1a723b61c32901a842c684e6b94 Mon Sep 17 00:00:00 2001 From: Language Lawyer Date: Wed, 23 Aug 2023 01:35:22 +0500 Subject: [PATCH 024/181] [intro.races] Make reading atomic objects nondeterministic --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index a2693df061..91b4626ee4 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -6270,7 +6270,7 @@ \pnum The value of an atomic object $M$, as determined by evaluation $B$, shall be the value -stored by some +stored by some unspecified side effect $A$ that modifies $M$, where $B$ does not happen before $A$. \begin{note} From df26017a6bfd74d794345ea9313eae1efacbf7c9 Mon Sep 17 00:00:00 2001 From: Jan Schultke Date: Wed, 8 Nov 2023 03:31:10 +0100 Subject: [PATCH 025/181] [diff.dcl] Replace 'field initializers' with 'member initializers' (#6482) --- source/compatibility.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compatibility.tex b/source/compatibility.tex index 185dc4f835..5fef3ab298 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -2768,7 +2768,7 @@ \rationale In \Cpp{}, members are destroyed in reverse construction order and the elements of an initializer list are evaluated in lexical order, -so field initializers must be specified in order. +so member initializers must be specified in order. Array designators conflict with \grammarterm{lambda-expression} syntax. Nested designators are seldom used. \effect From cc69fc0dd6b1a2fdc834bade578acb84cc7d2cfa Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 8 Nov 2023 10:54:52 +0800 Subject: [PATCH 026/181] [intro.races] Remove inappropriate uses of "shall" (#6457) --- source/basic.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index 91b4626ee4..57e021f6ad 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -6251,7 +6251,7 @@ \end{itemize} The value of a non-atomic scalar object or bit-field $M$, as determined by -evaluation $B$, shall be the value stored by the +evaluation $B$, is the value stored by the \indextext{side effects!visible}% visible side effect $A$. \begin{note} @@ -6269,7 +6269,7 @@ \pnum The value of an -atomic object $M$, as determined by evaluation $B$, shall be the value +atomic object $M$, as determined by evaluation $B$, is the value stored by some unspecified side effect $A$ that modifies $M$, where $B$ does not happen before $A$. @@ -6281,7 +6281,7 @@ \pnum \indextext{coherence!write-write}% If an operation $A$ that modifies an atomic object $M$ happens before -an operation $B$ that modifies $M$, then $A$ shall be earlier +an operation $B$ that modifies $M$, then $A$ is earlier than $B$ in the modification order of $M$. \begin{note} This requirement is known as write-write coherence. @@ -6293,7 +6293,7 @@ \indextext{value computation}% value computation $A$ of an atomic object $M$ happens before a value computation $B$ of $M$, and $A$ takes its value from a side -effect $X$ on $M$, then the value computed by $B$ shall either be +effect $X$ on $M$, then the value computed by $B$ is either the value stored by $X$ or the value stored by a \indextext{side effects}% side effect $Y$ on $M$, @@ -6307,7 +6307,7 @@ If a \indextext{value computation}% value computation $A$ of an atomic object $M$ happens before an -operation $B$ that modifies $M$, then $A$ shall take its value from a side +operation $B$ that modifies $M$, then $A$ takes its value from a side effect $X$ on $M$, where $X$ precedes $B$ in the modification order of $M$. \begin{note} @@ -6320,7 +6320,7 @@ If a \indextext{side effects}% side effect $X$ on an atomic object $M$ happens before a value -computation $B$ of $M$, then the evaluation $B$ shall take its +computation $B$ of $M$, then the evaluation $B$ takes its value from $X$ or from a \indextext{side effects}% side effect $Y$ that follows $X$ in the modification order of $M$. From 60e280391a06b8d27f778a56310b0827109623aa Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Thu, 31 Aug 2023 00:19:24 +0200 Subject: [PATCH 027/181] [cmath.syn] fix misaligned parameter lists --- source/numerics.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/numerics.tex b/source/numerics.tex index ae66b727ce..14308f349e 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -9193,13 +9193,13 @@ constexpr long double fminl(long double x, long double y); constexpr @\placeholder{floating-point-type}@ fma(@\placeholder{floating-point-type}@ x, @\placeholder{floating-point-type}@ y, - @\placeholder{floating-point-type}@ z); + @\placeholder{floating-point-type}@ z); constexpr float fmaf(float x, float y, float z); constexpr long double fmal(long double x, long double y, long double z); // \ref{c.math.lerp}, linear interpolation constexpr @\placeholder{floating-point-type}@ lerp(@\placeholder{floating-point-type}@ a, @\placeholder{floating-point-type}@ b, - @\placeholder{floating-point-type}@ t) noexcept; + @\placeholder{floating-point-type}@ t) noexcept; // \ref{c.math.fpclass}, classification / comparison functions constexpr int fpclassify(@\placeholder{floating-point-type}@ x); From c7fb99f884ec5f476d97a70fcb73119404f215fe Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Wed, 8 Nov 2023 05:55:30 -1000 Subject: [PATCH 028/181] [container.opt.reqmts] Index 3-way compare for containers (#6220) All of the standard containers are 3-way comparable, but the specification is provided under optional container requirements so does not show up in the index. --- source/containers.tex | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/containers.tex b/source/containers.tex index 45251b0de2..05ce110ac6 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -856,6 +856,26 @@ then the operations described below are implemented by constexpr functions. +% Local command to index a name as a member of all containers. +\renewcommand{\indexcont}[1]{% +\indexlibrarymisc{\idxcode{#1}}{optional container requirements}% +\indexlibrarymemberx{array}{#1}% +\indexlibrarymemberx{deque}{#1}% +\indexlibrarymemberx{forward_list}{#1}% +\indexlibrarymemberx{list}{#1}% +\indexlibrarymemberx{vector}{#1}% +\indexlibrarymemberx{map}{#1}% +\indexlibrarymemberx{set}{#1}% +\indexlibrarymemberx{multiset}{#1}% +\indexlibrarymemberx{multimap}{#1}% +\indexlibrarymemberx{flat_map}{#1}% +\indexlibrarymemberx{flat_set}{#1}% +\indexlibrarymemberx{flat_multiset}{#1}% +\indexlibrarymemberx{flat_multimap}{#1}% +\indexlibrarymemberx{basic_string}{#1}% +} + +\indexcont{operator<=>}% \begin{itemdecl} a <=> b \end{itemdecl} From 646bfb2a060e3c7f490f6c4672ee93a0cbaf6d0d Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Wed, 8 Nov 2023 05:59:28 -1000 Subject: [PATCH 029/181] [container.alloc.reqmts] Better xrefs for allocator-aware containers There are now more allocator-aware containers in the standard than when this subclause was first written, so ensure we have call outs to all relevent subclauses. The current wording for 'basic_stacktrace' also shows how containers can properly call out the allocator-aware container requirements, now that they have their own, titled subclause. --- source/containers.tex | 3 ++- source/regex.tex | 4 ++-- source/strings.tex | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 05ce110ac6..69494898fa 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -908,7 +908,8 @@ \rSec3[container.alloc.reqmts]{Allocator-aware containers} \pnum -All of the containers defined in \ref{containers} and in~\ref{basic.string} except \tcode{array} +Except for \tcode{array}, all of the containers defined in \ref{containers}, +\ref{stacktrace.basic}, \ref{basic.string}, and \ref{re.results} meet the additional requirements of an \defnadj{allocator-aware}{container}, as described below. diff --git a/source/regex.tex b/source/regex.tex index 5548adfea4..f8882f3d83 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -2135,8 +2135,8 @@ \indextext{requirements!container}% \indextext{requirements!sequence}% The class template \tcode{match_results} meets the requirements of an -allocator-aware container and of -a sequence container\iref{container.alloc.reqmts,sequence.reqmts} +allocator-aware container\iref{container.alloc.reqmts} and of +a sequence container\iref{container.requirements.general,sequence.reqmts} except that only copy assignment, move assignment, and diff --git a/source/strings.tex b/source/strings.tex index 7b5a1aef30..a403dd83ad 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -2378,7 +2378,7 @@ the character traits requirements\iref{char.traits}. \begin{note} Every specialization \tcode{basic_string} is -an allocator-aware container, +an allocator-aware container\iref{container.alloc.reqmts}, but does not use the allocator's \tcode{construct} and \tcode{destroy} member functions\iref{container.requirements.pre}. The program is ill-formed if From 62e33ca8a0a55764227e6a67c1f554783ffefe40 Mon Sep 17 00:00:00 2001 From: Hewill Kang <67143766+hewillk@users.noreply.github.com> Date: Thu, 9 Nov 2023 00:01:38 +0800 Subject: [PATCH 030/181] [time.zone.leap.overview] Fix example (#6383) --- source/time.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/time.tex b/source/time.tex index c788fcf12b..edf6306a6c 100644 --- a/source/time.tex +++ b/source/time.tex @@ -10159,7 +10159,7 @@ \begin{example} \begin{codeblock} for (auto& l : get_tzdb().leap_seconds) - if (l <= 2018y/March/17d) + if (l <= sys_days{2018y/March/17d}) cout << l.date() << ": " << l.value() << '\n'; \end{codeblock} From 07ae51af31587ac533b1b39c95777ecb725dcab0 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 25 Jan 2023 18:22:53 +0800 Subject: [PATCH 031/181] [expr.prim.req.general] Correct the IFNDR example --- source/expressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index 6933e50669..a7dd8e065e 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -2892,7 +2892,7 @@ \begin{codeblock} template concept C = requires { - new int[-(int)sizeof(T)]; // ill-formed, no diagnostic required + new decltype((void)T{}); // ill-formed, no diagnostic required }; \end{codeblock} \end{example} From f3059744c84f561f8ead4c5d117bc1160c43b7e2 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 8 Nov 2023 23:52:44 +0000 Subject: [PATCH 032/181] [defns.character.container] Improve note to entry (#6644) --- source/intro.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/intro.tex b/source/intro.tex index 32a759094d..e3858c184f 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -183,8 +183,9 @@ represent a character \begin{defnote} -It is used for one of the template parameters of the string, -iostream, and regular expression class templates. +It is used for one of the template parameters of \tcode{char_traits} +and the class templates which use that, +such as the string, iostream, and regular expression class templates. \end{defnote} \definition{collating element}{defns.regex.collating.element} From 8b38857b22f6518a41e506e4c9b2e9a1792a0fbd Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Tue, 10 Oct 2023 09:40:20 +0800 Subject: [PATCH 033/181] [iterator.requirements.general] Clarify non-forward iterator --- source/iterators.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/iterators.tex b/source/iterators.tex index ae0947e7f2..20af2a93dc 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -694,8 +694,9 @@ do not specify complexity. \pnum -Destruction of a non-forward iterator may invalidate pointers and references -previously obtained from that iterator. +Destruction of an iterator may invalidate pointers and references previously +obtained from that iterator if its type does not meet the +\oldconcept{ForwardIterator} requirements and does not model \libconcept{forward_iterator}. \pnum An \defnadj{invalid}{iterator} From fbb1a6ebbd1f78e644df2dbcb3ce31250410779e Mon Sep 17 00:00:00 2001 From: onihusube <44743040+onihusube@users.noreply.github.com> Date: Fri, 10 Nov 2023 08:36:12 +0900 Subject: [PATCH 034/181] [execpol.unseq] Fix missing \itemdescr (#5931) --- source/utilities.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/utilities.tex b/source/utilities.tex index 215b5ccf21..1b98667161 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -15115,6 +15115,7 @@ class execution::unsequenced_policy { @\unspec@ }; \end{itemdecl} +\begin{itemdescr} \pnum The class \tcode{unsequenced_policy} is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and @@ -15127,6 +15128,7 @@ the \tcode{execution::unsequenced_policy} policy, if the invocation of an element access function exits via an exception, \tcode{terminate} is invoked\iref{except.terminate}. +\end{itemdescr} \rSec2[execpol.objects]{Execution policy objects} From 10e2799f5d524dd941d424dfd08927c77a6b87f1 Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Fri, 17 Feb 2023 10:47:28 -0500 Subject: [PATCH 035/181] [pairs.pair] Consistent wording for assignment Apply a consistent pattern to how we specify assigning members in assignment operators. --- source/utilities.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index 1b98667161..fd9453e2e3 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -1075,8 +1075,8 @@ \pnum \effects -Assigns to \tcode{first} with \tcode{std::forward(p.first)} -and to \tcode{second} with \tcode{std::forward(\brk{}p.second)}. +Assigns \tcode{std::forward(p.first)} to \tcode{first} and +\tcode{std::forward(p.second)} to \tcode{second}. \pnum \returns @@ -1130,8 +1130,8 @@ \pnum \effects -Assigns to \tcode{first} with \tcode{std::forward(p.first)} -and to \tcode{second} with\\ \tcode{std::forward(p.second)}. +Assigns \tcode{std::forward(p.first)} \tcode{first} and +\tcode{std::forward(p.second)} to \tcode{second}. \pnum \returns From 78300aa38c23f1356dca8e786205e5aaf7769d01 Mon Sep 17 00:00:00 2001 From: Barry Revzin Date: Thu, 9 Nov 2023 14:45:17 -1000 Subject: [PATCH 036/181] [class.compare] Don't introduce `V` for the return value (#6035) In both cases, I'm not sure introducing `V` helps much - just requires name lookup for `V`. If we just say "the return value" in every case, I think that's clearer. --- source/classes.tex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index fb32d78051..a90967fe86 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -6503,7 +6503,7 @@ is usable\iref{class.compare.default}. \pnum -The return value \tcode{V} of a defaulted \tcode{==} operator function +The return value of a defaulted \tcode{==} operator function with parameters \tcode{x} and \tcode{y} is determined by comparing corresponding elements $\tcode{x}_i$ and $\tcode{y}_i$ in the expanded lists of subobjects for \tcode{x} and \tcode{y} @@ -6511,8 +6511,8 @@ until the first index $i$ where $\tcode{x}_i\tcode{ == }\tcode{y}_i$ yields a result value which, when contextually converted to \tcode{bool}, yields \tcode{false}. -If no such index exists, \tcode{V} is \tcode{true}. -Otherwise, \tcode{V} is \tcode{false}. +The return value is \tcode{true} if such an index exists +and \tcode{false} otherwise. \pnum \begin{example} @@ -6611,7 +6611,7 @@ \end{itemize} \pnum -The return value \tcode{V} of type \tcode{R} +The return value of type \tcode{R} of the defaulted three-way comparison operator function with parameters \tcode{x} and \tcode{y} of the same type is determined by comparing corresponding elements @@ -6622,10 +6622,10 @@ the synthesized three-way comparison of type \tcode{R} between $\tcode{x}_i$ and $\tcode{y}_i$ yields a result value $\tcode{v}_i$ where $\tcode{v}_i \mathrel{\tcode{!=}} 0$, -contextually converted to \tcode{bool}, yields \tcode{true}; -\tcode{V} is a copy of $\tcode{v}_i$. -If no such index exists, \tcode{V} is -\tcode{static_cast(std::strong_ordering::equal)}. +contextually converted to \tcode{bool}, yields \tcode{true}. +The return value is a copy of $\tcode{v}_i$ +if such an index exists and +\tcode{static_cast(std::strong_ordering::equal)} otherwise. \pnum The \defn{common comparison type} \tcode{U} From 838cb0649b1f4061e960772aee3563cedb20b108 Mon Sep 17 00:00:00 2001 From: Michael Florian Hava Date: Thu, 9 Nov 2023 13:51:58 -1000 Subject: [PATCH 037/181] [basic.extended.fp] Replaced usage of 'mantissa' with 'significand' according to SO/IEC/IEEE 60559:2008 --- source/basic.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index 57e021f6ad..fbd3455c3b 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -5248,8 +5248,8 @@ \pnum \begin{note} A summary of the parameters for each type is given in \tref{basic.extended.fp}. -The precision $p$ includes the implicit 1 bit at the beginning of the mantissa, -so the storage used for the mantissa is $p-1$ bits. +The precision $p$ includes the implicit 1 bit at the beginning of the significand, +so the storage used for the significand is $p-1$ bits. ISO/IEC/IEEE 60559 does not assign a name for a type having the parameters specified for \tcode{std::bfloat16_t}. \end{note} From ce5ef1b5334f1fc756d40e40ec300257b0ff99d9 Mon Sep 17 00:00:00 2001 From: Michael Florian Hava Date: Thu, 9 Nov 2023 13:57:32 -1000 Subject: [PATCH 038/181] [numeric.limits.members] Replaced usage of 'mantissa' with 'significand' according to SO/IEC/IEEE 60559:2008 --- source/support.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/support.tex b/source/support.tex index 4360c21e2c..4376a443cf 100644 --- a/source/support.tex +++ b/source/support.tex @@ -1069,7 +1069,7 @@ \pnum For floating-point types, the number of \tcode{radix} digits in the -mantissa. +significand. \begin{footnote} Equivalent to \tcode{FLT_MANT_DIG}, \tcode{DBL_MANT_DIG}, \tcode{LDBL_MANT_DIG}. From 3e1f377a9dc3bece7acd2dddb7237065504db65c Mon Sep 17 00:00:00 2001 From: Brian Bi Date: Thu, 9 Nov 2023 16:00:22 -1000 Subject: [PATCH 039/181] [macros, styles] Add \hypertarget to headings (#6516) This allows forming URLs with a stable label as a fragment and have PDF viewers jump to the corresponding (sub)clause. For example: std.pdf#basic.life --- source/macros.tex | 4 +++- source/styles.tex | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/macros.tex b/source/macros.tex index fd5293136d..f8c3e2b720 100644 --- a/source/macros.tex +++ b/source/macros.tex @@ -64,6 +64,7 @@ %% Cross-references. %%-------------------------------------------------- \newcommand{\addxref}[1]{% + \hypertarget{#1}{}% \glossary[xrefindex]{\indexescape{#1}}{(\ref{\indexescape{#1}})}% } @@ -92,6 +93,7 @@ % defines a first-level section whose name is "Scope" and whose short % tag is intro.scope. The square brackets are mandatory. \def\Sec#1[#2]#3{% +\addxref{#2}% \ifcase#1\let\s=\chapter\let\l=\clauselabel \or\let\s=\section\let\l=\label \or\let\s=\subsection\let\l=\label @@ -99,7 +101,7 @@ \or\let\s=\paragraph\let\l=\label \or\let\s=\subparagraph\let\l=\label \fi% -\s[#3]{#3\hfill[#2]}\l{#2}\addxref{#2}% +\s[#3]{#3\hfill[#2]}\l{#2}% } % A convenience feature (mostly for the convenience of the Project diff --git a/source/styles.tex b/source/styles.tex index d77f983b38..9258953c1c 100644 --- a/source/styles.tex +++ b/source/styles.tex @@ -87,8 +87,8 @@ %%-------------------------------------------------- % set heading style for annexes \newcommand{\Annex}[3]{\chapter[#2]{(#3)\protect\\#2\hfill[#1]}\relax\annexlabel{#1}} -\newcommand{\infannex}[2]{\Annex{#1}{#2}{informative}\addxref{#1}} -\newcommand{\normannex}[2]{\Annex{#1}{#2}{normative}\addxref{#1}} +\newcommand{\infannex}[2]{\addxref{#1}\Annex{#1}{#2}{informative}} +\newcommand{\normannex}[2]{\addxref{#1}\Annex{#1}{#2}{normative}} %%-------------------------------------------------- %% set footnote style From 60f7bb72cdd36e9d359fa7aea84a5b836079a0ed Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Thu, 6 Jul 2023 13:41:56 +0200 Subject: [PATCH 040/181] [namespace.std] convert (a) and (b) notation to items --- source/lib-intro.tex | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 9adcc68775..9e55a779b6 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -2844,10 +2844,11 @@ any standard library class template to namespace \tcode{std} provided that -(a) the added declaration -depends on at least one program-defined type -and -(b) the specialization meets the standard library requirements +\begin{itemize} +\item the added declaration +depends on at least one program-defined type, and + +\item the specialization meets the standard library requirements for the original template. \begin{footnote} Any @@ -2855,6 +2856,7 @@ must be prepared to work adequately with any user-supplied specialization that meets the minimum requirements of this document. \end{footnote} +\end{itemize} \pnum The behavior of a \Cpp{} program is undefined @@ -2885,10 +2887,12 @@ A program may explicitly instantiate a class template defined in the standard library only if the declaration -(a) depends on the name of at least one program-defined type -and -(b) the instantiation meets the standard library requirements for the +\begin{itemize} +\item depends on the name of at least one program-defined type, and + +\item the instantiation meets the standard library requirements for the original template. +\end{itemize} \pnum Let \tcode{\placeholder{F}} denote From f48f316c42c6cb67058d9f9106852154497b4516 Mon Sep 17 00:00:00 2001 From: Jan Schultke Date: Fri, 10 Nov 2023 06:57:17 +0100 Subject: [PATCH 041/181] [atomics.order] Use "recommended practice" (#6380) --- source/threads.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/threads.tex b/source/threads.tex index f43a6abf36..79d65f86aa 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -2646,8 +2646,10 @@ the read-modify-write operation. \pnum -Implementations should make atomic stores visible to atomic loads within a reasonable -amount of time. +\recommended +The implementation should make atomic stores visible to atomic loads, +and atomic loads should observe atomic stores, +within a reasonable amount of time. \indexlibraryglobal{kill_dependency}% \begin{itemdecl} From 1ec1d9e6fa98734b3edf20f6c2217a4482f78103 Mon Sep 17 00:00:00 2001 From: Hewill Kang <67143766+hewillk@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:59:21 +0800 Subject: [PATCH 042/181] [meta.{unary.prop.query,trans.arr] Use `static_assert` instead of `assert` in example --- source/meta.tex | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/source/meta.tex b/source/meta.tex index 90c9ab892a..17cbbf91dd 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -1407,9 +1407,9 @@ \begin{example} \begin{codeblock} // the following assertions hold: -assert(rank_v == 0); -assert(rank_v == 1); -assert(rank_v == 2); +static_assert(rank_v == 0); +static_assert(rank_v == 1); +static_assert(rank_v == 2); \end{codeblock} \end{example} @@ -1417,14 +1417,14 @@ \begin{example} \begin{codeblock} // the following assertions hold: -assert(extent_v == 0); -assert(extent_v == 2); -assert(extent_v == 2); -assert(extent_v == 0); -assert((extent_v) == 0); -assert((extent_v) == 0); -assert((extent_v) == 4); -assert((extent_v) == 4); +static_assert(extent_v == 0); +static_assert(extent_v == 2); +static_assert(extent_v == 2); +static_assert(extent_v == 0); +static_assert(extent_v == 0); +static_assert(extent_v == 0); +static_assert(extent_v == 4); +static_assert(extent_v == 4); \end{codeblock} \end{example} @@ -1823,10 +1823,10 @@ \begin{example} \begin{codeblock} // the following assertions hold: -assert((is_same_v, int>)); -assert((is_same_v, int>)); -assert((is_same_v, int[3]>)); -assert((is_same_v, int[3]>)); +static_assert(is_same_v, int>); +static_assert(is_same_v, int>); +static_assert(is_same_v, int[3]>); +static_assert(is_same_v, int[3]>); \end{codeblock} \end{example} @@ -1834,10 +1834,10 @@ \begin{example} \begin{codeblock} // the following assertions hold: -assert((is_same_v, int>)); -assert((is_same_v, int>)); -assert((is_same_v, int>)); -assert((is_same_v, int>)); +static_assert(is_same_v, int>); +static_assert(is_same_v, int>); +static_assert(is_same_v, int>); +static_assert(is_same_v, int>); \end{codeblock} \end{example} From bd8f4540720e52dab9187a62c5598e735aeacfdd Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Sat, 19 Aug 2023 15:57:39 +0200 Subject: [PATCH 043/181] [expr.sizeof] use constexpr member in example --- source/expressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index a7dd8e065e..d44a832ce4 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -5004,7 +5004,7 @@ \begin{codeblock} template struct count { - static const std::size_t value = sizeof...(Types); + static constexpr std::size_t value = sizeof...(Types); }; \end{codeblock} \end{example} From b1f922a126dcda78acb4bae055843e7a7321fe1d Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Wed, 23 Aug 2023 13:42:39 +0200 Subject: [PATCH 044/181] [basic.def.odr] Fix hyphenation of "{copy,move} assignment" --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index fbd3455c3b..7b29e927dd 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -489,7 +489,7 @@ \pnum An assignment operator function in a class is odr-used by an implicitly-defined -copy-assignment or move-assignment function for another class as specified +copy assignment or move assignment function for another class as specified in~\ref{class.copy.assign}. A constructor for a class is odr-used as specified in~\ref{dcl.init}. A destructor for a class is odr-used if it is potentially From 54e465a17adfcba56a57ff2fefe43ec898725efb Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Wed, 23 Aug 2023 13:43:46 +0200 Subject: [PATCH 045/181] [res.on.arguments] Fix hyphenation of "move assignment" --- source/lib-intro.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 9e55a779b6..6fe8e8fa0e 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -3360,7 +3360,7 @@ \item If a function argument is bound to an rvalue reference parameter, the implementation may assume that this parameter is a unique reference to this argument, -except that the argument passed to a move-assignment operator may be +except that the argument passed to a move assignment operator may be a reference to \tcode{*this}\iref{lib.types.movedfrom}. \begin{note} If the type of a parameter is a forwarding reference\iref{temp.deduct.call} From 3c5b5b0c58d0440233d992e1a0791a449936f203 Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Wed, 23 Aug 2023 13:44:40 +0200 Subject: [PATCH 046/181] [futures.{unique,shared}.future] Fix hyphenation of "{copy,move} assignment" --- source/threads.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/threads.tex b/source/threads.tex index 79d65f86aa..ab471217c1 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -10575,7 +10575,7 @@ \pnum The effect of calling any member function other than the destructor, the -move-assignment operator, \tcode{share}, or \tcode{valid} on a \tcode{future} object for which +move assignment operator, \tcode{share}, or \tcode{valid} on a \tcode{future} object for which \tcode{valid() == false} is undefined. \begin{note} @@ -10882,7 +10882,7 @@ \pnum The effect of calling any member function other than the destructor, -the move-assignment operator, the copy-assignment operator, or +the move assignment operator, the copy assignment operator, or \tcode{valid()} on a \tcode{shared_future} object for which \tcode{valid() == false} is undefined. \begin{note} It is valid to copy or move from a \tcode{shared_future} From 9483cb7cf6973689ad563d30778d8da2dff42a8d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 8 Nov 2023 22:57:57 +0000 Subject: [PATCH 047/181] [string.capacity] Remove parentheses from "reserve()" It's very confusing to talk about `reserve()` when describing a call to `reserve(size_type)`, given that the overload `reserve()` also exists. --- source/strings.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/strings.tex b/source/strings.tex index a403dd83ad..c0213a348a 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -3009,8 +3009,8 @@ \effects A directive that informs a \tcode{basic_string} of a planned change in size, so that the storage allocation can be managed accordingly. -After -\tcode{reserve()}, +Following a call to +\tcode{reserve}, \tcode{capacity()} is greater or equal to the argument of \tcode{reserve} @@ -3019,7 +3019,7 @@ \tcode{capacity()} otherwise. Reallocation happens at this point if and only if -the current capacity is less than the argument of \tcode{reserve()}. +the current capacity is less than the argument of \tcode{reserve}. \pnum \throws From 2a9f28670a0df6e239d9b335bdb014f20f577732 Mon Sep 17 00:00:00 2001 From: lprv <100177227+lprv@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:19:01 +0000 Subject: [PATCH 048/181] [dcl.meaning.general] Use 'declarator-id' instead of 'name' --- source/declarations.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/declarations.tex b/source/declarations.tex index f1a7bcdbb9..c2d7a9771f 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -2757,7 +2757,8 @@ \tcode{D} where \tcode{D} -is an unadorned name, the type of the declared entity is +is an unadorned \grammarterm{declarator-id}, +the type of the declared entity is ``\tcode{T}''. \pnum From d8b72f0ceb36b3537ef576ab216d588642e332ab Mon Sep 17 00:00:00 2001 From: lprv <100177227+lprv@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:26:03 +0000 Subject: [PATCH 049/181] [module.global.frag] Simplify wording Also make variable order consistent across bullets. --- source/modules.tex | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/modules.tex b/source/modules.tex index 3d299b553c..acb04fb625 100644 --- a/source/modules.tex +++ b/source/modules.tex @@ -639,14 +639,13 @@ \item $D$ is decl-reachable from $M$, or \item -$D$ redeclares the entity declared by $M$ or -$M$ redeclares the entity declared by $D$, +$D$ and $M$ declare the same entity, and $D$ neither is a friend declaration nor inhabits a block scope, or \item $D$ declares a namespace $N$ and $M$ is a member of $N$, or \item -one of $M$ and $D$ declares a class or class template $C$ +one of $D$ and $M$ declares a class or class template $C$ and the other declares a member or friend of $C$, or \item one of $D$ and $M$ declares an enumeration $E$ @@ -659,11 +658,11 @@ \end{footnote} or \item -one of $M$ and $D$ declares a template and the other declares +one of $D$ and $M$ declares a template and the other declares a partial or explicit specialization or an implicit or explicit instantiation of that template, or \item -one of $M$ and $D$ declares a class or enumeration type +one of $D$ and $M$ declares a class or enumeration type and the other introduces a typedef name for linkage purposes for that type. \end{itemize} \end{itemize} From f0c172c5604b47c3ecc7b64669aad660df403624 Mon Sep 17 00:00:00 2001 From: Oliver Rosten Date: Fri, 10 Nov 2023 18:12:06 +0000 Subject: [PATCH 050/181] [algorithms] Change stable label "mismatch" to "alg.mismatch" (#6653) --- source/algorithms.tex | 4 ++-- source/xrefdelta.tex | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/algorithms.tex b/source/algorithms.tex index 5fe7ecfb5e..ffe860726a 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -977,7 +977,7 @@ count_if(R&& r, Pred pred, Proj proj = {}); } - // \ref{mismatch}, mismatch + // \ref{alg.mismatch}, mismatch template constexpr pair mismatch(InputIterator1 first1, InputIterator1 last1, @@ -4044,7 +4044,7 @@ of the corresponding predicate and any projection. \end{itemdescr} -\rSec2[mismatch]{Mismatch} +\rSec2[alg.mismatch]{Mismatch} \indexlibraryglobal{mismatch}% \begin{itemdecl} diff --git a/source/xrefdelta.tex b/source/xrefdelta.tex index 0dfd2c1380..2ed6a08997 100644 --- a/source/xrefdelta.tex +++ b/source/xrefdelta.tex @@ -33,6 +33,9 @@ % https://github.com/cplusplus/draft/pull/6255 \movedxref{container.gen.reqmts}{container.requirements.general} +% https://github.com/cplusplus/draft/pull/6653 +\movedxref{mismatch}{alg.mismatch} + %%% Deprecated features. %%% Example: % From d97603a90d2fcfeec2caf4371ca9e6c8f562842a Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sat, 11 Nov 2023 03:21:17 +0800 Subject: [PATCH 051/181] [forward.iterators] Use "Cpp17" requirement (#6612) --- source/iterators.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/iterators.tex b/source/iterators.tex index 20af2a93dc..b765432c95 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -2214,7 +2214,7 @@ \pnum A class or pointer type \tcode{X} -meets the requirements of a forward iterator if +meets the \oldconcept{ForwardIterator} requirements if \begin{itemize} \item \tcode{X} meets the \oldconcept{InputIterator} requirements\iref{input.iterators}, From f474227b69d10350999a5fc63503725421a89954 Mon Sep 17 00:00:00 2001 From: Geng Cheng Date: Sat, 11 Nov 2023 10:25:39 +0800 Subject: [PATCH 052/181] [stringstream.general] Add missing template argument "Allocator" (#6560) --- source/iostreams.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/iostreams.tex b/source/iostreams.tex index 4de815cac6..155919c60f 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -9588,7 +9588,7 @@ void str(const T& t); private: - basic_stringbuf sb; // \expos + basic_stringbuf sb; // \expos }; } \end{codeblock} From f5fdfe453e5a1e0370f2cb28bfc2dfeecab6370e Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Wed, 8 Nov 2023 15:12:16 -1000 Subject: [PATCH 053/181] [diff.cpp20.library] Add missing new headers for C++23 --- source/compatibility.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/compatibility.tex b/source/compatibility.tex index 5fef3ab298..70716c9d45 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -202,10 +202,12 @@ \libheaderrefx{flat_map}{flat.map.syn}, \libheaderrefx{flat_set}{flat.set.syn}, \libheaderref{generator}, +\libheaderref{mdspan}, \libheaderref{print}, \libheaderref{spanstream}, -\libheaderref{stacktrace}, and -\libheaderref{stdatomic.h}. +\libheaderref{stacktrace}, +\libheaderref{stdatomic.h}, and +\libheaderref{stdfloat}. Valid \CppXX{} code that \tcode{\#include}{s} headers with these names may be invalid in this revision of \Cpp{}. From 38dfe3db0f08bd09a2b445ba82e83f7caae28d94 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Thu, 9 Nov 2023 11:00:44 +0800 Subject: [PATCH 054/181] [dcl.init.ref] Clarify "related type" "Related type" is not a term, "reference-related type" is clearer. --- source/declarations.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index c2d7a9771f..929bd6a027 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -5721,9 +5721,10 @@ const int& r3 = a; // error: cv-qualifier dropped // from result of conversion function double d2 = 1.0; -double&& rrd2 = d2; // error: initializer is lvalue of related type +double&& rrd2 = d2; // error: initializer is lvalue of reference-related type struct X { operator int&(); }; -int&& rri2 = X(); // error: result of conversion function is lvalue of related type +int&& rri2 = X(); // error: result of conversion function is + // lvalue of reference-related type int i3 = 2; double&& rrd3 = i3; // \tcode{rrd3} refers to temporary with value \tcode{2.0} \end{codeblock} From 979983929bb592c02c9ae3e52f1c676dd5ae06fe Mon Sep 17 00:00:00 2001 From: Hewill Kang <67143766+hewillk@users.noreply.github.com> Date: Tue, 14 Nov 2023 02:27:01 +0800 Subject: [PATCH 055/181] [range.cartesian.view] Don't name unused template parameter (#6177) --- source/ranges.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ranges.tex b/source/ranges.tex index 2a455af9e2..e7f3c4946a 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -14982,7 +14982,7 @@ (@\libconcept{bidirectional_range}@<@\exposid{maybe-const}@> && @\exposconcept{cartesian-product-common-arg}@<@\exposid{maybe-const}@>)); - template + template concept @\defexposconcept{cartesian-product-is-common}@ = // \expos @\exposconcept{cartesian-product-common-arg}@; From ecbeb5ad4e4c0ac1d0cdb5e8dd01daab8df8d62e Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Tue, 14 Nov 2023 14:27:27 -0500 Subject: [PATCH 056/181] [diff.cpp23.library] Entry for new headers in C++26 (#6648) --- source/compatibility.tex | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/compatibility.tex b/source/compatibility.tex index 70716c9d45..8de5989e0c 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -31,6 +31,21 @@ bool b = ne({2,3}, {1,2,3}); // unspecified result; previously \tcode{false} \end{codeblock} +\rSec2[diff.cpp23.library]{\ref{library}: library introduction} + +\diffref{headers} +\change +New headers. +\rationale +New functionality. +\effect +The following \Cpp{} headers are new: +\libheaderrefx{hazard_pointer}{hazard.pointer.syn}, +\libheaderref{rcu}, and +\libheaderrefx{text_encoding}{text.encoding.syn}. +Valid \CppXXIII{} code that \tcode{\#include}{s} headers with these names may be +invalid in this revision of \Cpp{}. + \rSec2[diff.cpp23.strings]{\ref{strings}: strings library} \diffref{string.conversions} From eb7f0bcbff2af109643089ef36dfe67040a27f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Mon, 13 Nov 2023 01:12:50 -1000 Subject: [PATCH 057/181] [intro.defs, macros] Add cross-references among definitions Fixes ISO/CS 017 (C++23 DIS). --- source/intro.tex | 59 ++++++++++++++++++++++++----------------------- source/macros.tex | 1 + 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/source/intro.tex b/source/intro.tex index e3858c184f..b49baba83a 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -180,7 +180,7 @@ \defncontext{library} \indexdefn{type!character container}% class or a type used to -represent a character +represent a \termref{defns.character}{character}{} \begin{defnote} It is used for one of the template parameters of \tcode{char_traits} @@ -190,13 +190,13 @@ \definition{collating element}{defns.regex.collating.element} \indexdefn{collating element}% -sequence of one or more characters within the +sequence of one or more \termref{defns.character}{character}{s} within the current locale that collate as if they were a single character \definition{component}{defns.component} \defncontext{library} \indexdefn{component}% -group of library entities directly related as members, parameters, or +group of library entities directly related as members, \termref{defns.parameter}{parameter}{s}, or return types \begin{defnote} @@ -226,13 +226,13 @@ \indexdefn{deadlock}% situation wherein one or more threads are unable to continue execution because each is -blocked waiting for one or more of the others to satisfy some condition +\termref{defns.block}{block}{ed} waiting for one or more of the others to satisfy some condition \definition{default behavior}{defns.default.behavior.impl} \indexdefn{behavior!default}% \defncontext{library implementation} specific behavior provided by the implementation, -within the scope of the required behavior +within the scope of the \termref{defns.required.behavior}{required behavior}{} \indexdefn{message!diagnostic}% \definition{diagnostic message}{defns.diagnostic} @@ -254,7 +254,7 @@ \indexdefn{type!dynamic}% \definition{dynamic type}{defns.dynamic.type.prvalue} -\defncontext{prvalue} static type of the prvalue expression +\defncontext{prvalue} \termref{defns.static.type}{static type}{} of the prvalue expression \definition{expression-equivalent}{defns.expression.equivalent} \defncontext{library} @@ -265,7 +265,7 @@ are all not potentially-throwing, and either -are all constant subexpressions or +are all \termref{defns.const.subexpr}{constant subexpression}{s} or are all not constant subexpressions \begin{example} @@ -283,14 +283,14 @@ \defncontext{regular expression} \indexdefn{finite state machine}% unspecified data structure that is used to -represent a regular expression, and which permits efficient matches +represent a \termref{defns.regex.regular.expression}{regular expression}{}, and which permits efficient matches against the regular expression to be obtained \definition{format specifier}{defns.regex.format.specifier} \defncontext{regular expression} \indexdefn{format specifier}% -sequence of one or more characters that is to be -replaced with some part of a regular expression match +sequence of one or more \termref{defns.character}{character}{s} that is to be +replaced with some part of a \termref{defns.regex.regular.expression}{regular expression}{} match \definition{handler function}{defns.handler} \defncontext{library} @@ -309,7 +309,7 @@ \indexdefn{behavior!implementation-defined}% \definition{implementation-defined behavior}{defns.impl.defined} -behavior, for a well-formed program construct and correct data, that +behavior, for a \termref{defns.well.formed}{well-formed program}{} construct and correct data, that depends on the implementation and that each implementation documents \definition{implementation-defined strict total order over pointers} @@ -335,7 +335,7 @@ \defncontext{regular expression} \indexdefn{matched}% \indexdefn{regular expression!matched}% -condition when a sequence of zero or more characters +condition when a sequence of zero or more \termref{defns.character}{character}{s} correspond to a sequence of characters defined by the pattern \definition{modifier function}{defns.modifier} @@ -366,7 +366,7 @@ \indexdefn{NTCTS}% \indexdefn{string!null-terminated character type}% sequence of values that have -character type +\termref{defns.character}{character}{} type that precede the terminating null character type value \tcode{charT()} @@ -406,7 +406,7 @@ \definition{primary equivalence class}{defns.regex.primary.equivalence.class} \defncontext{regular expression} \indexdefn{primary equivalence class}% -set of one or more characters which +set of one or more \termref{defns.character}{character}{s} which share the same primary sort key: that is the sort key weighting that depends only upon character shape, and not accents, case, or locale specific tailorings @@ -425,7 +425,7 @@ that is not part of the \Cpp{} standard library and not defined by the implementation, or a closure type of a non-implementation-provided lambda expression, -or an instantiation of a program-defined specialization +or an instantiation of a \termref{defns.prog.def.spec}{program-defined specialization}{} \begin{defnote} Types defined by the implementation include @@ -462,7 +462,7 @@ \definition{regular expression}{defns.regex.regular.expression} pattern that selects specific strings -from a set of character strings +from a set of \termref{defns.character}{character}{} strings \definition{replacement function}{defns.replacement} \defncontext{library} @@ -479,7 +479,8 @@ \definition{required behavior}{defns.required.behavior} \defncontext{library} \indexdefn{behavior!required}% -description of replacement function and handler function semantics +description of \termref{defns.replacement}{replacement function}{} +and \termref{defns.handler}{handler function}{} semantics applicable to both the behavior provided by the implementation and the behavior of any such function definition in the program @@ -528,7 +529,7 @@ parameter-type-list, enclosing namespace, return type, -signature of the \grammarterm{template-head}, +\termref{defns.signature.template.head}{signature}{} of the \grammarterm{template-head}, and trailing \grammarterm{requires-clause} (if any) @@ -539,14 +540,14 @@ parameter-type-list, return type, enclosing class, -signature of the \grammarterm{template-head}, +\termref{defns.signature.template.head}{signature}{} of the \grammarterm{template-head}, and trailing \grammarterm{requires-clause} (if any) \indexdefn{signature}% \definition{signature}{defns.signature.spec} -\defncontext{function template specialization} signature of the template of which it is a specialization -and its template arguments (whether explicitly specified or deduced) +\defncontext{function template specialization} \termref{defns.signature.templ}{signature}{} of the template of which it is a specialization +and its template \termref{defns.argument.templ}{argument}{s} (whether explicitly specified or deduced) \indexdefn{signature}% \definition{signature}{defns.signature.member} @@ -568,20 +569,20 @@ \cv-qualifiers (if any), \grammarterm{ref-qualifier} (if any), return type (if any), -signature of the \grammarterm{template-head}, +\termref{defns.signature.template.head}{signature}{} of the \grammarterm{template-head}, and trailing \grammarterm{requires-clause} (if any) \indexdefn{signature}% \definition{signature}{defns.signature.member.spec} -\defncontext{class member function template specialization} signature of the member function template +\defncontext{class member function template specialization} \termref{defns.signature.member.templ}{signature}{} of the member function template of which it is a specialization and its template arguments (whether explicitly specified or deduced) \indexdefn{signature}% \definition{signature}{defns.signature.template.head} \defncontext{\grammarterm{template-head}} -template parameter list, -excluding template parameter names and default arguments, +template \termref{defns.parameter.templ}{parameter}{} list, +excluding template parameter names and default \termref{defns.argument.templ}{argument}{s}, and \grammarterm{requires-clause} (if any) @@ -610,7 +611,7 @@ \definition{sub-expression}{defns.regex.subexpression} \defncontext{regular expression} \indexdefn{sub-expression!regular expression}% -subset of a regular expression that has +subset of a \termref{defns.regex.regular.expression}{regular expression}{} that has been marked by parentheses \definition{traits class}{defns.traits} @@ -621,7 +622,7 @@ \indexdefn{unblock}% \definition{unblock}{defns.unblock} -satisfy a condition that one or more blocked threads of execution are waiting for +satisfy a condition that one or more \termref{defns.block}{block}{ed} threads of execution are waiting for \indexdefn{behavior!undefined}% \definition{undefined behavior}{defns.undefined} @@ -636,7 +637,7 @@ from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a -diagnostic message), to terminating a translation or execution (with the +\termref{defns.diagnostic}{diagnostic message}{}), to terminating a translation or execution (with the issuance of a diagnostic message). Many erroneous program constructs do not engender undefined behavior; they are required to be diagnosed. Evaluation of a constant expression\iref{expr.const} never exhibits behavior explicitly @@ -645,7 +646,7 @@ \indexdefn{behavior!unspecified}% \definition{unspecified behavior}{defns.unspecified} -behavior, for a well-formed program construct and correct data, that +behavior, for a \termref{defns.well.formed}{well-formed program}{} construct and correct data, that depends on the implementation \begin{defnote} diff --git a/source/macros.tex b/source/macros.tex index f8c3e2b720..bcf6c38964 100644 --- a/source/macros.tex +++ b/source/macros.tex @@ -368,6 +368,7 @@ %% Cross-reference \newcommand{\xref}{\textsc{See also:}\space} \newcommand{\xrefc}[1]{\xref{} \IsoC{}, #1} +\newcommand{\termref}[3]{\textit{#2}{#3}\iref{#1}} % in Clause 3 %% Inline comma-separated parenthesized references \ExplSyntaxOn From 706880e4ed855ae76d503c70adfb0015bbfb3df0 Mon Sep 17 00:00:00 2001 From: Lewis Baker Date: Thu, 16 Nov 2023 10:36:25 +1030 Subject: [PATCH 058/181] [allocator.requirements.general] Fix missing ellipsis (#6695) --- source/lib-intro.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 6fe8e8fa0e..858fb6f51c 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -2572,7 +2572,7 @@ \end{itemdescr} \begin{itemdecl} -a.construct(c, args) +a.construct(c, args...) \end{itemdecl} \begin{itemdescr} From 5c0103c0a656cbcd725780388b0879e992a1b21a Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 16 Nov 2023 15:38:47 +0000 Subject: [PATCH 059/181] [stacktrace.format], [stacktrace.basic.hash] change rSec3 to rSec2 These should not be nested below std::basic_stacktrace because they apply to both std::stacktrace_entry and std::basic_stacktrace. --- source/diagnostics.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 12a3cb75b0..9d049077ee 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2400,7 +2400,7 @@ Equivalent to: \tcode{return os << to_string(st);} \end{itemdescr} -\rSec3[stacktrace.format]{Formatting support} +\rSec2[stacktrace.format]{Formatting support} \begin{itemdecl} template<> struct formatter; @@ -2442,7 +2442,7 @@ copying \tcode{to_string(s)} through the output iterator of the context. \end{itemdescr} -\rSec3[stacktrace.basic.hash]{Hash support} +\rSec2[stacktrace.basic.hash]{Hash support} \begin{itemdecl} template<> struct hash; From fdce2a73b40f5ede64c04981e635ac1c24294278 Mon Sep 17 00:00:00 2001 From: Bryce Adelstein Lelbach aka wash Date: Sat, 18 Nov 2023 12:55:09 -0500 Subject: [PATCH 060/181] [algorithms.parallel.defns] Fix indentation in example (#6707) --- source/algorithms.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/algorithms.tex b/source/algorithms.tex index ffe860726a..ecb7f96a8c 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -348,7 +348,7 @@ int a[] = {1,2}; std::for_each(std::execution::par_unseq, std::begin(a), std::end(a), [&](int) { std::lock_guard guard(m); // incorrect: \tcode{lock_guard} constructor calls \tcode{m.lock()} - ++x; + ++x; }); } \end{codeblock} From a6ad6083ab75901cb41b5bc8d034c0b322433457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Tue, 5 Dec 2023 23:42:23 +0000 Subject: [PATCH 061/181] [std, styles] Adjust table captions as per ISO request ISO has asked for captions to be bold and table numbers to be separated by a dash. --- source/std.tex | 1 + source/styles.tex | 2 ++ 2 files changed, 3 insertions(+) diff --git a/source/std.tex b/source/std.tex index f179e402e8..c97d4302bd 100644 --- a/source/std.tex +++ b/source/std.tex @@ -13,6 +13,7 @@ {listings} % code listings \usepackage{longtable} % auto-breaking tables \usepackage{ltcaption} % fix captions for long tables +\usepackage{caption} % caption style \usepackage{relsize} % provide relative font size changes \usepackage{textcomp} % provide \text{l,r}angle \usepackage{underscore} % remove special status of '_' in ordinary text diff --git a/source/styles.tex b/source/styles.tex index 9258953c1c..8d771e10db 100644 --- a/source/styles.tex +++ b/source/styles.tex @@ -113,6 +113,8 @@ %%-------------------------------------------------- %% set caption style \captionstyle{\centering} +\DeclareCaptionLabelSeparator{emdash}{ --- } +\captionsetup{labelsep=emdash,font+=bf} %%-------------------------------------------------- %% set global styles that get reset by \mainmatter From 5995b52695f47d35d212bd33acced6bfdc5a86b1 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Tue, 5 Dec 2023 21:17:23 +0100 Subject: [PATCH 062/181] [basic.scope.pdecl] Add missing \grammarterm markup --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index 7b29e927dd..31354656ac 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -1206,7 +1206,7 @@ \pnum The locus of a \grammarterm{concept-definition} -is immediately after its concept-name\iref{temp.concept}. +is immediately after its \grammarterm{concept-name}\iref{temp.concept}. \begin{note} The \grammarterm{constraint-expression} cannot use the \grammarterm{concept-name}. From f519ea4aa97592703ba5bbe9164242d946723721 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 7 Dec 2023 01:00:53 +0100 Subject: [PATCH 063/181] [intro.refs, time.format] Update references from ISO 8601:2004 to ISO 8601-1:2019 (#6720) --- source/intro.tex | 3 +-- source/time.tex | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/intro.tex b/source/intro.tex index b49baba83a..d2b327a324 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -34,8 +34,7 @@ \begin{itemize} % ISO documents in numerical order. \item ISO/IEC 2382, \doccite{Information technology --- Vocabulary} -\item ISO 8601:2004, \doccite{Data elements and interchange formats --- -Information interchange --- Representation of dates and times} +\item ISO 8601-1:2019, \doccite{Date and time --- Representations for information interchange --- Part 1: Basic rules} \item \IsoC{}, \doccite{Information technology --- Programming languages --- C} \item ISO/IEC/IEEE 9945:2009, \doccite{Information Technology --- Portable Operating System Interface (POSIX diff --git a/source/time.tex b/source/time.tex index edf6306a6c..8f4b13de72 100644 --- a/source/time.tex +++ b/source/time.tex @@ -10533,7 +10533,7 @@ Each conversion specifier \fmtgrammarterm{conversion-spec} is replaced by appropriate characters as described in \tref{time.format.spec}; -the formats specified in ISO 8601:2004 shall be used where so described. +the formats specified in ISO 8601-1:2019 shall be used where so described. Some of the conversion specifiers depend on the formatting locale. If the string literal encoding is a Unicode encoding form and @@ -10793,7 +10793,7 @@ the locale's alternative full year representation. \\ \rowsep \tcode{\%z} & -The offset from UTC as specified in ISO 8601:2004, subclause 4.2.5.2. +The offset from UTC as specified in ISO 8601-1:2019, subclause 5.3.4.1. For example \tcode{-0430} refers to 4 hours 30 minutes behind UTC\@. If the offset is zero, \tcode{+0000} is used. The modified commands \tcode{\%Ez} and \tcode{\%Oz} From 37956fb3685c2c279bd6b4b701964b20913d0c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Wed, 6 Dec 2023 19:01:29 +0000 Subject: [PATCH 064/181] [syntax] Change "italic" to "italic, sans-serif" We changed the grammar non-terminal font to sans-serif, so we should update the description. --- source/intro.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/intro.tex b/source/intro.tex index d2b327a324..a49eb3a7b5 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -954,7 +954,7 @@ \pnum \indextext{notation!syntax|(}% In the syntax notation used in this document, syntactic -categories are indicated by \fakegrammarterm{italic} type, and literal words +categories are indicated by \fakegrammarterm{italic, sans-serif} type, and literal words and characters in \tcode{constant} \tcode{width} type. Alternatives are listed on separate lines except in a few cases where a long set of alternatives is marked by the phrase ``one of''. If the text of an alternative is too long to fit on a line, the text is continued on subsequent lines indented from the first one. From 4eed7a0f1e44c45554f8a210af34fd6e1ea19596 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 7 Dec 2023 22:13:35 +0100 Subject: [PATCH 065/181] [intro.abstract] Actually use the phrase 'unspecified/undefined behavior' Fixes ISO/CS 011 (C++23 DIS). --- source/intro.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/intro.tex b/source/intro.tex index a49eb3a7b5..30702183df 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -849,7 +849,7 @@ \pnum \indextext{behavior!implementation-defined}% Certain aspects and operations of the abstract machine are described in this -document as implementation-defined (for example, +document as implementation-defined behavior (for example, \tcode{sizeof(int)}). These constitute the parameters of the abstract machine. Each implementation shall include documentation describing its characteristics and behavior in these respects. @@ -865,7 +865,7 @@ \pnum \indextext{behavior!unspecified}% Certain other aspects and operations of the abstract machine are -described in this document as unspecified (for example, +described in this document as unspecified behavior (for example, order of evaluation of arguments in a function call\iref{expr.call}). Where possible, this document defines a set of allowable behaviors. These @@ -876,7 +876,7 @@ \pnum \indextext{behavior!undefined}% Certain other operations are described in this document as -undefined (for example, the effect of +undefined behavior (for example, the effect of attempting to modify a const object). \begin{note} This document imposes no requirements on the From 4d586056455b70554009ff7e6c866b5b564dcf81 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 15 Dec 2023 16:52:55 -0500 Subject: [PATCH 066/181] [class.friend] Fix a mistakenly monospaced "friend declaration" (#6736) --- source/classes.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/classes.tex b/source/classes.tex index a90967fe86..ca9f7206cf 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -4850,7 +4850,7 @@ a \grammarterm{template-declaration}\iref{temp.pre,temp.friend}. \end{note} If the -type specifier in a \keyword{friend} declaration designates a (possibly +type specifier in a friend declaration designates a (possibly cv-qualified) class type, that class is declared as a friend; otherwise, the friend declaration is ignored. \begin{example} From f8a6138da1e431779ac43a893faa32f3f0cad7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Thu, 7 Dec 2023 12:45:11 +0000 Subject: [PATCH 067/181] [intro.defs] Fix introductory text according to ISO rules. In principle, "symbols and abbreviated terms" can be listed in a standard, and can be listed in a separate clause or in a combined clause 3 "Terms, definitions, symbols and abbreviated terms", we do not actually need symbol definitions. In any case, the introductory text would never mention "symbols". --- source/intro.tex | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/intro.tex b/source/intro.tex index 30702183df..a4fff15300 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -76,9 +76,7 @@ \indextext{definitions|(}% For the purposes of this document, the terms and definitions -given in ISO/IEC 2382, -the terms, definitions, and symbols -given in ISO 80000-2:2009, +given in ISO/IEC 2382 and ISO 80000-2:2009, and the following apply. \pnum From 9961cd4f16aca645c77d6927526ea71f635a2932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Thu, 7 Dec 2023 00:01:48 +0000 Subject: [PATCH 068/181] [introduction] A minimal "Introduction" clause This clause explains our conventions regarding stable labels and choice of fonts. --- source/preface.tex | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/preface.tex b/source/preface.tex index 1e11dd524f..b77caca873 100644 --- a/source/preface.tex +++ b/source/preface.tex @@ -1,4 +1,19 @@ %!TEX root = std.tex + \chapter{Foreword} [This page is intentionally left blank.] + +\chapter{Introduction} + +Clauses and subclauses in this document are annotated +with a so-called stable name, +presented in square brackets next to the (sub)clause heading +(such as ``[lex.token]'' for subclause \ref{lex.token}, ``Tokens''). +Stable names aid in the discussion and evolution of this document +by serving as stable references to subclauses across editions +that are unaffected by changes of subclause numbering. + +Aspects of the language syntax of \Cpp{} are distinguished typographically +by the use of \fakegrammarterm{italic, sans-serif} type +or \tcode{constant width} type to avoid ambiguities; see \ref{syntax}. From e6a9da69703951aa8a14f18d5eeb93b9fa41200c Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 11:18:16 -0800 Subject: [PATCH 069/181] CWG2054 Missing description of class SFINAE --- source/templates.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/templates.tex b/source/templates.tex index f107d82813..78ec22a551 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -7162,8 +7162,9 @@ The \defn{deduction substitution loci} are \begin{itemize} \item the function type outside of the \grammarterm{noexcept-specifier}, -\item the \grammarterm{explicit-specifier}, and -\item the template parameter declarations. +\item the \grammarterm{explicit-specifier}, +\item the template parameter declarations, and +\item the template argument list of a partial specialization\iref{temp.spec.partial.general}. \end{itemize} The substitution occurs in all types and expressions that are used in the deduction substitution loci. From 2290a037ceb307c3a1f9d851041ddefb6b090f8a Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:01:25 -0800 Subject: [PATCH 070/181] CWG2102 Constructor checking in new-expression [dcl.init.general] Format to match previous itemized list and remove "then". --- source/declarations.tex | 20 ++++++++++++++------ source/expressions.tex | 22 ++++++++++++++++++---- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 929bd6a027..f2e870acd8 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -4481,7 +4481,10 @@ \item If \tcode{T} -is an array type, each element is default-initialized. +is an array type, +the semantic constraints of default-initializing a hypothetical element +shall be met and +each element is default-initialized. \item Otherwise, @@ -4520,9 +4523,10 @@ an object of type \tcode{T} means: + \begin{itemize} \item -if +If \tcode{T} is a (possibly cv-qualified) class type\iref{class}, then \begin{itemize} @@ -4534,15 +4538,19 @@ otherwise, the object is zero-initialized and the semantic constraints for default-initialization are checked, and if \tcode{T} has a -non-trivial default constructor, the object is default-initialized; +non-trivial default constructor, the object is default-initialized. \end{itemize} + \item -if +If \tcode{T} -is an array type, then each element is value-initialized; +is an array type, +the semantic constraints of value-initializing a hypothetical element +shall be met and +each element is value-initialized. \item -otherwise, the object is zero-initialized. +Otherwise, the object is zero-initialized. \end{itemize} \pnum diff --git a/source/expressions.tex b/source/expressions.tex index d44a832ce4..4357ffe2f2 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -5287,6 +5287,21 @@ When the value of the \grammarterm{expression} is zero, the allocation function is called to allocate an array with no elements. +\pnum +If the allocated type is an array, +the \grammarterm{new-initializer} is a \grammarterm{braced-init-list}, and +the \grammarterm{expression} +is potentially-evaluated and not a core constant expression, +the semantic constraints of copy-initializing a hypothetical element of +the array from an empty initializer list +are checked\iref{dcl.init.list}. +\begin{note} +The array can contain more elements than there are +elements in the \grammarterm{braced-init-list}, +requiring initialization of the remainder of the array elements from +an empty initializer list. +\end{note} + \pnum \indextext{storage duration!dynamic}% Objects created by a \grammarterm{new-expression} have dynamic storage @@ -5585,10 +5600,6 @@ \grammarterm{new-expression}. \pnum -If the \grammarterm{new-expression} creates an object or an array of -objects of class type, access and ambiguity control are done for the -allocation function, the deallocation function\iref{basic.stc.dynamic.deallocation}, and -the constructor\iref{class.ctor} selected for the initialization (if any). If the \grammarterm{new-expression} creates an array of objects of class type, the destructor is potentially invoked\iref{class.dtor}. @@ -5638,6 +5649,9 @@ ill-formed. For a non-placement allocation function, the normal deallocation function lookup is used to find the matching deallocation function\iref{expr.delete}. +In any case, +the matching deallocation function (if any) shall be non-deleted and +accessible from the point where the \grammarterm{new-expression} appears. \begin{example} \begin{codeblock} struct S { From 1cbe98e6603ebce06cad1c0d401134493c5feb11 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:09:15 -0800 Subject: [PATCH 071/181] CWG2252 Enumeration list-initialization from the same type --- source/declarations.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/declarations.tex b/source/declarations.tex index f2e870acd8..fa91187389 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -5922,7 +5922,7 @@ \item Otherwise, if \tcode{T} is an enumeration with a fixed underlying type\iref{dcl.enum} \tcode{U}, -the \grammarterm{initializer-list} has a single element \tcode{v}, +the \grammarterm{initializer-list} has a single element \tcode{v} of scalar type, \tcode{v} can be implicitly converted to \tcode{U}, and the initialization is direct-list-initialization, the object is initialized with the value \tcode{T(v)}\iref{expr.type.conv}; From ead2f0a3fd5ad82f95d35dab2ac1996540382cdf Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:17:57 -0800 Subject: [PATCH 072/181] CWG2504 Inheriting constructors from virtual base classes --- source/classes.tex | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index ca9f7206cf..02db51667e 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -5818,9 +5818,16 @@ were used to initialize the \tcode{D} object and each base class subobject from which the constructor was inherited, except that the \tcode{B} subobject is initialized -by the invocation of the inherited constructor. +by the inherited constructor +if the base class subobject were to be initialized +as part of the \tcode{D} object\iref{class.base.init}. +The invocation of the inherited constructor, +including the evaluation of any arguments, +is omitted if the \tcode{B} subobject is not to be initialized +as part of the \tcode{D} object. The complete initialization is considered to be a single function call; -in particular, the initialization of the inherited constructor's parameters +in particular, unless omitted, +the initialization of the inherited constructor's parameters is sequenced before the initialization of any part of the \tcode{D} object. \begin{example} \begin{codeblock} @@ -5870,6 +5877,23 @@ whenever an object of class \tcode{Log} is destroyed. \end{example} +\begin{example} +\begin{codeblock} +struct V { V() = default; V(int); }; +struct Q { Q(); }; +struct A : virtual V, Q { + using V::V; + A() = delete; +}; +int bar() { return 42; } +struct B : A { + B() : A(bar()) {} // OK +}; +struct C : B {}; +void foo() { C c; } // \tcode{bar} is not invoked, because the \tcode{V} subobject is not initialized as part of \tcode{B} +\end{codeblock} +\end{example} + \pnum If the constructor was inherited from multiple base class subobjects of type \tcode{B}, the program is ill-formed. From 17ad6db86009ed3d7b4f557b5288512301341f34 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:19:40 -0800 Subject: [PATCH 073/181] CWG2531 Static data members redeclared as constexpr --- source/declarations.tex | 1 + 1 file changed, 1 insertion(+) diff --git a/source/declarations.tex b/source/declarations.tex index fa91187389..658a0ae9d3 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -813,6 +813,7 @@ the declaration of a function or function template. A function or static data member declared with the \keyword{constexpr} or \keyword{consteval} specifier +on its first declaration is implicitly an inline function or variable\iref{dcl.inline}. If any declaration of a function or function template has a \keyword{constexpr} or \keyword{consteval} specifier, From c1e3e24975d7b8b431b08fbf474a54f77f085e9b Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:22:10 -0800 Subject: [PATCH 074/181] CWG2556 Unusable promise::return_void --- source/statements.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/statements.tex b/source/statements.tex index 4c8bef837e..e255195234 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -950,7 +950,8 @@ \end{itemize} \pnum -If \placeholder{p}\tcode{.return_void()} is a valid expression, +If a search for the name \tcode{return_void} in the scope of the promise type +finds any declarations, flowing off the end of a coroutine's \grammarterm{function-body} is equivalent to a \keyword{co_return} with no operand; otherwise flowing off the end of a coroutine's \grammarterm{function-body} From f5dde4dfc24d9a7a07673467efbad3c2e0f5b984 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:23:51 -0800 Subject: [PATCH 075/181] CWG2570 Clarify constexpr for defaulted functions --- source/declarations.tex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/declarations.tex b/source/declarations.tex index 658a0ae9d3..5ce3247631 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6394,6 +6394,9 @@ is implicitly inline\iref{dcl.inline}, and is implicitly constexpr\iref{dcl.constexpr} if it is constexpr-suitable. +\begin{note} +Other defaulted functions are not implicitly constexpr. +\end{note} \pnum \begin{example} From e3076f8d8fb99e8360f071f642e53a2c1f2ad495 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:31:57 -0800 Subject: [PATCH 076/181] CWG2591 Implicit change of active union member for anonymous union in union --- source/classes.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/classes.tex b/source/classes.tex index 02db51667e..6b9d828169 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -3155,7 +3155,10 @@ In an assignment expression of the form \tcode{E1 = E2} that uses either the built-in assignment operator\iref{expr.ass} or a trivial assignment operator\iref{class.copy.assign}, -for each element \tcode{X} of $S($\tcode{E1}$)$, +for each element \tcode{X} of $S($\tcode{E1}$)$ and +each anonymous union member \tcode{X}\iref{class.union.anon} that +is a member of a union and +has such an element as an immediate subobject (recursively), if modification of \tcode{X} would have undefined behavior under~\ref{basic.life}, an object of the type of \tcode{X} is implicitly created in the nominated storage; From 58a96f11cc5b1bb926d162a2c97b117ef5129b46 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:34:43 -0800 Subject: [PATCH 077/181] CWG2595 "More constrained" for eligible special member functions --- source/classes.tex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/classes.tex b/source/classes.tex index 6b9d828169..b9c42db35c 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -1095,7 +1095,9 @@ \begin{itemize} \item the function is not deleted, \item the associated constraints\iref{temp.constr}, if any, are satisfied, and -\item no special member function of the same kind is more constrained\iref{temp.constr.order}. +\item no special member function of the same kind +whose associated constraints, if any, are satisfied +is more constrained\iref{temp.constr.order}. \end{itemize} \pnum From c8cca13f57144c58f5228c8d8a65910f09d9a08c Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 12:59:25 -0800 Subject: [PATCH 078/181] CWG2600 Type dependency of placeholder types --- source/expressions.tex | 4 +++- source/templates.tex | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index 4357ffe2f2..9a7c6fea77 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -5139,7 +5139,9 @@ \end{bnf} \pnum -If a placeholder type\iref{dcl.spec.auto} appears in the +If a placeholder type\iref{dcl.spec.auto} or +a placeholder for a deduced class type\iref{dcl.type.class.deduct} +appears in the \grammarterm{type-specifier-seq} of a \grammarterm{new-type-id} or \grammarterm{type-id} of a \grammarterm{new-expression}, the allocated type is deduced as follows: diff --git a/source/templates.tex b/source/templates.tex index 78ec22a551..8025a498e6 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -5016,6 +5016,45 @@ \end{codeblock} \end{example} +\pnum +An initializer is dependent if +any constituent expression\iref{intro.execution} of the initializer +is type-dependent. +A placeholder type\iref{dcl.spec.auto.general} is dependent if +it designates a type deduced from a dependent initializer. + +\pnum +A placeholder for a deduced class type\iref{dcl.type.class.deduct} +is dependent if +\begin{itemize} +\item +it has a dependent initializer, or +\item +it refers to an alias template +that is a member of the current instantiation and +whose \grammarterm{defining-type-id} is dependent after +class template argument deduction\iref{over.match.class.deduct} +and substitution\iref{temp.alias}. +\end{itemize} + +\pnum +\begin{example} +\begin{codeblock} +template +struct S { S(T); }; + +template +struct A { + template using X = S; + template using Y = S; + void f() { + new X(1); // dependent + new Y(1); // not dependent + } +}; +\end{codeblock} +\end{example} + \pnum A type is dependent if it is \begin{itemize} @@ -5038,6 +5077,10 @@ \item a function type whose exception specification is value-dependent, \item +denoted by a dependent placeholder type, +\item +denoted by a dependent placeholder for a deduced class type, +\item denoted by a \grammarterm{simple-template-id} in which either the template name is a template parameter or any of the template arguments is a dependent type or an expression that is type-dependent From bd1822653a601a5e5bad6e392fe00059b785a006 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 13:01:57 -0800 Subject: [PATCH 079/181] CWG2628 Implicit deduction guides should propagate constraints --- source/overloading.tex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/overloading.tex b/source/overloading.tex index f357452fa6..27bfb26749 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -1198,6 +1198,10 @@ by the template parameters (including default template arguments) of the constructor, if any. \item +The associated constraints\iref{temp.constr.decl} are the conjunction of +the associated constraints of \tcode{C} and +the associated constraints of the constructor. +\item The types of the function parameters are those of the constructor. \item The return type is the class template specialization From f303385d0dacfca64947a41e61122eedec11ae6a Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 13:20:46 -0800 Subject: [PATCH 080/181] CWG2672 Lambda body SFINAE is still required, contrary to intent and note --- source/expressions.tex | 6 ++++-- source/templates.tex | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 9a7c6fea77..f7822d93bd 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -2871,8 +2871,10 @@ \pnum The substitution of template arguments into a \grammarterm{requires-expression} -may result in the formation of invalid types or expressions in its -\grammarterm{requirement}s or the violation of the semantic constraints of those \grammarterm{requirement}s. +can result in +the formation of invalid types or expressions in the immediate context of +its \grammarterm{requirement}s\iref{temp.deduct.general} or +the violation of the semantic constraints of those \grammarterm{requirement}s. In such cases, the \grammarterm{requires-expression} evaluates to \keyword{false}; it does not cause the program to be ill-formed. The substitution and semantic constraint checking diff --git a/source/templates.tex b/source/templates.tex index 8025a498e6..c1f766767a 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -1671,7 +1671,8 @@ \defnx{satisfied}{constraint!satisfaction!atomic}, the parameter mapping and template arguments are first substituted into its expression. -If substitution results in an invalid type or expression, +If substitution results in an invalid type or expression +in the immediate context of the atomic constraint\iref{temp.deduct.general}, the constraint is not satisfied. Otherwise, the lvalue-to-rvalue conversion\iref{conv.lval} is performed if necessary, @@ -7266,9 +7267,8 @@ \end{note} \pnum -A \grammarterm{lambda-expression} appearing in a function type -or a template parameter is not considered part of the immediate context -for the purposes of template argument deduction. +When substituting into a \grammarterm{lambda-expression}, +substitution into its body is not in the immediate context. \begin{note} The intent is to avoid requiring implementations to deal with substitution failure involving arbitrary statements. From f3bed0c01bab6830de2c980f0d02659dfed7516f Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 13:24:15 -0800 Subject: [PATCH 081/181] CWG2725 Overload resolution for non-call of class member access Also fixes CWG1038. --- source/expressions.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index f7822d93bd..54dd4d2e73 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -3619,6 +3619,8 @@ ``\cvqual{cq12} \cvqual{vq12} \tcode{T}''. \item If \tcode{E2} is an overload set, +the expression shall be the (possibly-parenthesized) left-hand operand of +a member function call\iref{expr.call}, and function overload resolution\iref{over.match} is used to select the function to which \tcode{E2} refers. The type of \tcode{E1.E2} is the type of \tcode{E2} @@ -3629,8 +3631,7 @@ \tcode{E1.E2} is an lvalue. \item Otherwise (when \tcode{E2} refers to a non-static member function), -\tcode{E1.E2} is a prvalue. The expression can be used only as the -left-hand operand of a member function call\iref{class.mfct}. +\tcode{E1.E2} is a prvalue. \begin{note} Any redundant set of parentheses surrounding the expression is ignored\iref{expr.prim.paren}. From 92b99b6d7ba268163cbf18c72e46a0ca4a4e9ca5 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 13:49:38 -0800 Subject: [PATCH 082/181] CWG2733 Applying [[maybe_unused]] to a label --- source/declarations.tex | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 5ce3247631..190b414903 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -9143,15 +9143,18 @@ \pnum The \grammarterm{attribute-token} \tcode{maybe_unused} -indicates that a name or entity is possibly intentionally unused. +indicates that a name, label, or entity is possibly intentionally unused. No \grammarterm{attribute-argument-clause} shall be present. \pnum The attribute may be applied to the declaration of a class, -a \grammarterm{typedef-name}, -a variable (including a structured binding declaration), -a non-static data member, -a function, an enumeration, or an enumerator. +\grammarterm{typedef-name}, +variable (including a structured binding declaration), +non-static data member, +function, +enumeration, or +enumerator, or +to an \grammarterm{identifier} label\iref{stmt.label}. \pnum A name or entity declared without the \tcode{maybe_unused} attribute @@ -9169,6 +9172,8 @@ For a structured binding declaration not marked \tcode{maybe_unused}, implementations should not emit such a warning unless all of its structured bindings are unused. +For a label to which \tcode{maybe_unused} is applied, +implementations should not emit a warning that the label is used or unused. The value of a \grammarterm{has-attribute-expression} for the \tcode{maybe_unused} attribute should be \tcode{0} @@ -9181,9 +9186,13 @@ [[maybe_unused]] bool thing2) { [[maybe_unused]] bool b = thing1 && thing2; assert(b); +#ifdef NDEBUG + goto x; +#endif + [[maybe_unused]] x: } \end{codeblock} -Implementations should not warn that \tcode{b} is unused, +Implementations should not warn that \tcode{b} or \tcode{x} is unused, whether or not \tcode{NDEBUG} is defined. \end{example} From c5b42c96ee35a19b46d60f18d3b7ecc7e138d3fd Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 13:54:49 -0800 Subject: [PATCH 083/181] CWG2747 Cannot depend on an already-deleted splice Also fixes CWG1698. --- source/lex.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/lex.tex b/source/lex.tex index b4b81cf407..0aaac3d151 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -112,8 +112,8 @@ Line splicing can form a \grammarterm{universal-character-name}\iref{lex.charset}. \end{note} -A source file that is not empty and that does not end in a new-line -character, or that ends in a splice, +A source file that is not empty and that (after splicing) +does not end in a new-line character shall be processed as if an additional new-line character were appended to the file. From 7b2b2e1db5bf249d34a94f8519706d4bff41d21f Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 13:59:20 -0800 Subject: [PATCH 084/181] CWG2749 Treatment of "pointer to void" for relational comparisons --- source/expressions.tex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index 54dd4d2e73..1e0d2300b2 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -6595,8 +6595,10 @@ Otherwise, the result of each of the operators is unspecified. \begin{note} A relational operator applied -to unequal function pointers or to unequal pointers to \tcode{void} +to unequal function pointers yields an unspecified result. +A pointer value of type ``pointer to \cv{}~\keyword{void}'' +can point to an object\iref{basic.compound}. \end{note} \pnum From eed7b9c8c6caf83b8fcc70a2bd74005b6c925102 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 14:21:43 -0800 Subject: [PATCH 085/181] CWG2753 Storage reuse for string literal objects and backing arrays --- source/basic.tex | 18 +++++++++++++++++- source/declarations.tex | 5 +++-- source/lex.tex | 7 ++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index 31354656ac..f8e5b28942 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3300,6 +3300,12 @@ standard-layout type\iref{basic.types.general} shall occupy contiguous bytes of storage. +\pnum +An object is a \defnadj{potentially non-unique}{object} if it is +a string literal object\iref{lex.string}, +the backing array of an initializer list\iref{dcl.init.ref}, or +a subobject thereof. + \pnum \indextext{most derived object!bit-field}% \indextext{most derived object!zero size subobject}% @@ -3312,7 +3318,9 @@ if one is nested within the other, or if at least one is a subobject of zero size -and they are of different types; +and they are of different types, +or +if they are both potentially non-unique objects; otherwise, they have distinct addresses and occupy disjoint bytes of storage. \begin{footnote} @@ -3326,6 +3334,14 @@ static const char test1 = 'x'; static const char test2 = 'x'; const bool b = &test1 != &test2; // always \tcode{true} + +static const char (&r) [] = "x"; +static const char *s = "x"; +static std::initializer_list il = { 'x' }; +const bool b2 = r != il.begin(); // unspecified result +const bool b3 = r != s; // unspecified result +const bool b4 = il.begin() != &test1; // always \tcode{true} +const bool b5 = r != &test1; // always \tcode{true} \end{codeblock} \end{example} The address of a non-bit-field subobject of zero size is diff --git a/source/declarations.tex b/source/declarations.tex index 190b414903..957bde9820 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6069,8 +6069,9 @@ \end{note} If a narrowing conversion is required to initialize any of the elements, the program is ill-formed. -Whether all backing arrays are distinct -(that is, are stored in non-overlapping objects) is unspecified. +\begin{note} +Backing arrays are potentially non-unique objects\iref{intro.object}. +\end{note} \pnum The backing array has the same lifetime as any other temporary diff --git a/source/lex.tex b/source/lex.tex index 0aaac3d151..41d0e4702d 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -1955,11 +1955,12 @@ \pnum Evaluating a \grammarterm{string-literal} results in a string literal object with static storage duration\iref{basic.stc}. -\indextext{string!distinct}% -Whether all \grammarterm{string-literal}s are distinct (that is, are stored in -nonoverlapping objects) and whether successive evaluations of a +\begin{note} +String literal objects are potentially non-unique\iref{intro.object}. +Whether successive evaluations of a \grammarterm{string-literal} yield the same or a different object is unspecified. +\end{note} \begin{note} \indextext{literal!string!undefined change to}% The effect of attempting to modify a string literal object is undefined. From 6cb09a1f863f256f530a48044fc31c70775a1cbb Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 14:24:39 -0800 Subject: [PATCH 086/181] [intro.object] Use bullets to help clarify wording added in CWG2753. --- source/basic.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index f8e5b28942..0cd7cbacc8 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3314,13 +3314,13 @@ Two objects with overlapping lifetimes that are not bit-fields -may have the same address -if one is nested within the other, -or -if at least one is a subobject of zero size -and they are of different types, +may have the same address if +\begin{itemize} +\item one is nested within the other, +\item at least one is a subobject of zero size and they are of different types, or -if they are both potentially non-unique objects; +\item they are both potentially non-unique objects; +\end{itemize} otherwise, they have distinct addresses and occupy disjoint bytes of storage. \begin{footnote} From 07113e56937a839c05b75771beebc78f61c8d13a Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 14:31:03 -0800 Subject: [PATCH 087/181] CWG2754 Using *this in explicit object member functions that are coroutines --- source/declarations.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 957bde9820..193fae5031 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6620,10 +6620,10 @@ where $\tcode{p}_1$ denotes the object parameter and $\tcode{p}_{i+1}$ denotes the $i^\text{th}$ non-object function parameter -for a non-static member function, and +for an implicit object member function, and $\tcode{p}_i$ denotes the $i^\text{th}$ function parameter otherwise. -For a non-static member function, +For an implicit object 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$, From 667129ba5404641780d04e73a9287868ad2867dc Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 14:40:05 -0800 Subject: [PATCH 088/181] CWG2755 Incorrect wording applied by P2738R1 --- source/expressions.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index 1e0d2300b2..f1df63bd58 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -7521,7 +7521,8 @@ \item a conversion from a prvalue \tcode{P} of type ``pointer to \cv{}~\keyword{void}'' -to a pointer-to-object type \tcode{T} +to a type ``\cvqual{cv1} pointer to \tcode{T}'', +where \tcode{T} is not \cvqual{cv2}~\keyword{void}, unless \tcode{P} points to an object whose type is similar to \tcode{T}; \item From 73bb723f6df7a39ca480c575420162dcd7ed7938 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 14:57:38 -0800 Subject: [PATCH 089/181] CWG2758 What is "access and ambiguity control"? --- source/expressions.tex | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index f1df63bd58..2aaa0ef302 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -5790,9 +5790,12 @@ null pointer value and the selected deallocation function (see below) is not a destroying operator delete, -the \grammarterm{delete-expression} will invoke the +evaluating the \grammarterm{delete-expression} invokes the destructor (if any) for the object or the elements of the array being -deleted. In the case of an array, the elements will be destroyed in +deleted. +The destructor shall be accessible from the point where +the \grammarterm{delete-expression} appears. +In the case of an array, the elements are destroyed in order of decreasing address (that is, in reverse order of the completion of their constructor; see~\ref{class.base.init}). @@ -5873,8 +5876,7 @@ \end{note} \pnum -If more than one deallocation function is found, -the function to be called is selected as follows: +The deallocation the function to be called is selected as follows: \begin{itemize} \item If any of the deallocation functions is a destroying operator delete, @@ -5903,6 +5905,10 @@ whether a deallocation function with a parameter of type \tcode{std::size_t} is selected. \end{itemize} +Unless the deallocation function is selected +at the point of definition of the dynamic type's virtual destructor, +the selected deallocation function shall be accessible +from the point where the \grammarterm{delete-expression} appears. \pnum For a single-object delete expression, @@ -5956,10 +5962,6 @@ the behavior is undefined\iref{new.delete.single,new.delete.array}. \end{note} -\pnum -Access and ambiguity control are done for both the deallocation function -and the destructor\iref{class.dtor,class.free}. - \rSec2[expr.cast]{Explicit type conversion (cast notation)}% \indextext{expression!cast|(} From 218cee1a278c377e563ba9171125a9ddc75a1209 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 15:03:53 -0800 Subject: [PATCH 090/181] CWG2759 [[no_unique_address] and common initial sequence --- source/classes.tex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index b9c42db35c..a2f5ca9aa9 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -796,9 +796,10 @@ \item corresponding entities have the same alignment requirements\iref{basic.align}, \item -either both entities are declared with -the \tcode{no_unique_address} attribute\iref{dcl.attr.nouniqueaddr} -or neither is, and +if a \grammarterm{has-attribute-expression}\iref{cpp.cond} +is not \tcode{0} for the \tcode{no_unique_address} attribute, +then neither entity is declared with +the \tcode{no_unique_address} attribute\iref{dcl.attr.nouniqueaddr}, and \item either both entities are bit-fields with the same width or neither is a bit-field. From 25dd30298acfb6a0f3562fa569fa2d2e53136806 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 15:15:32 -0800 Subject: [PATCH 091/181] CWG2760 Defaulted constructor that is an immediate function --- source/declarations.tex | 7 ++++++- source/expressions.tex | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/declarations.tex b/source/declarations.tex index 193fae5031..5a104e53ec 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6234,7 +6234,12 @@ \end{bnf} Any informal reference to the body of a function should be interpreted as a reference to -the non-terminal \grammarterm{function-body}. +the non-terminal \grammarterm{function-body}, +including, for a constructor, +default member initializers or default initialization +used to initialize +a base or member subobject in the absence of +a \grammarterm{mem-initializer-id}\iref{class.base.init}. The optional \grammarterm{attribute-specifier-seq} in a \grammarterm{function-definition} appertains to the function. A \grammarterm{virt-specifier-seq} can be part of a \grammarterm{function-definition} diff --git a/source/expressions.tex b/source/expressions.tex index 2aaa0ef302..79f952589f 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -7983,6 +7983,11 @@ whose function body contains an immediate-escalating expression \tcode{\placeholder{E}} such that \tcode{\placeholder{E}}'s innermost enclosing non-block scope is \tcode{\placeholder{F}}'s function parameter scope. +\begin{tailnote} +Default member initializers used to initialize +a base or member subobject\iref{class.base.init} +are considered to be part of the function body\iref{dcl.fct.def.general}. +\end{tailnote} \end{itemize} \begin{example} \begin{codeblock} From f41b5358bd05af1b520939c363b9678a71eb4992 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 15:28:35 -0800 Subject: [PATCH 092/181] CWG2761 Implicitly invoking the deleted destructor of an anonymous union member --- source/classes.tex | 3 ++- source/declarations.tex | 1 + source/exceptions.tex | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index a2f5ca9aa9..2d033e48c9 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -2117,7 +2117,8 @@ \tcode{X} calls the destructors for \tcode{X}'s -direct non-variant non-static data members, the destructors for +direct non-variant non-static data members other than anonymous unions, +the destructors for \tcode{X}'s non-virtual direct base classes and, if \tcode{X} diff --git a/source/declarations.tex b/source/declarations.tex index 5a104e53ec..af9a1f875b 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -5097,6 +5097,7 @@ \pnum The destructor for each element of class type +other than an anonymous union member is potentially invoked\iref{class.dtor} from the context where the aggregate initialization occurs. \begin{note} diff --git a/source/exceptions.tex b/source/exceptions.tex index c4cc789ff9..8dc2fcbc05 100644 --- a/source/exceptions.tex +++ b/source/exceptions.tex @@ -421,7 +421,8 @@ \end{note} \indextext{subobject!initialized, known to be}% A subobject is \defn{known to be initialized} -if its initialization is specified +if it is not an anonymous union member and +its initialization is specified \begin{itemize} \item in \ref{class.base.init} for initialization by constructor, \item in \ref{class.copy.ctor} for initialization by defaulted copy/move constructor, From 65dd47befb02280163d05eda0b3a40c78895fddb Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 15:30:01 -0800 Subject: [PATCH 093/181] CWG2762 Type of implicit object parameter --- source/overloading.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/overloading.tex b/source/overloading.tex index 27bfb26749..92deb259d2 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -185,7 +185,7 @@ \end{itemize} where \tcode{X} -is the class of which the function is a member and +is the class of which the function is a direct member and \cv{} is the cv-qualification on the member function declaration. From 12270011519cfd4236bcb0c9529b5285adae3b60 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 15:38:01 -0800 Subject: [PATCH 094/181] CWG2763 Ignorability of [[noreturn]] during constant evaluation --- source/expressions.tex | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 79f952589f..45f2a4af6f 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -7447,7 +7447,7 @@ \item an operation that would have undefined behavior as specified in \ref{intro} through \ref{cpp}, -excluding \ref{dcl.attr.assume}; +excluding \ref{dcl.attr.assume} and \ref{dcl.attr.noreturn}; \begin{footnote} This includes, for example, signed integer overflow\iref{expr.pre}, certain @@ -7604,6 +7604,7 @@ \end{note} \end{itemize} +\pnum It is unspecified whether $E$ is a core constant expression if $E$ satisfies the constraints of a core constant expression, but evaluation of $E$ would evaluate @@ -7612,7 +7613,12 @@ an operation that has undefined behavior as specified in \ref{library} through \ref{\lastlibchapter}, \item -an invocation of the \tcode{va_start} macro\iref{cstdarg.syn}, or +an invocation of the \tcode{va_start} macro\iref{cstdarg.syn}, +\item +a call to a function +that was previously declared +with the \tcode{noreturn} attribute\iref{dcl.attr.noreturn} and +that call returns to its caller, or \item a statement with an assumption\iref{dcl.attr.assume} whose converted \grammarterm{conditional-expression}, From 36a989c3aeb06f194ad0bec659845ea5b81e2629 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 15:54:40 -0800 Subject: [PATCH 095/181] CWG2764 Use of placeholders affecting name mangling --- source/basic.tex | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index 0cd7cbacc8..088f531817 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -1000,10 +1000,22 @@ \pnum A declaration is \defnx{name-independent}{declaration!name-independent} if its name is \tcode{_} (\unicode{005f}{low line}) and it declares +\begin{itemize} +\item a variable with automatic storage duration, -a structured binding not inhabiting a namespace scope, +\item +a structured binding +%FIXME: "and" is strange below; maybe reword to something like: +%FIXME: "that has no \grammarterm{storage-class-specifier} and +%FIXME: that is not inhabiting a namespace scope," +with no \grammarterm{storage-class-specifier} and +not inhabiting a namespace scope, +\item the variable introduced by an \grammarterm{init-capture}, or -a non-static data member. +\item +%FIXME: "of" is strange below; remove it? +a non-static data member of other than an anonymous union. +\end{itemize} \recommended Implementations should not emit a warning From 9539ea76d87e44ed794450622fd5b58f969916b5 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 16:19:27 -0800 Subject: [PATCH 096/181] CWG2768 Assignment to enumeration variable with a braced-init-list --- source/expressions.tex | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 45f2a4af6f..091a2f4242 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -7254,17 +7254,22 @@ \end{note} \pnum -A \grammarterm{braced-init-list} may appear on the right-hand side of +A \grammarterm{braced-init-list} $B$ may appear on the right-hand side of + \begin{itemize} -\item an assignment to a scalar, in which case the initializer list shall have -at most a single element. The meaning of \tcode{x = \{v\}}, where \tcode{T} is the -scalar type of the expression \tcode{x}, is that of \tcode{x = T\{v\}}. The meaning of -\tcode{x = \{\}} is \tcode{x = T\{\}}. +\item +an assignment to a scalar of type \tcode{T}, in which case $B$ +shall have at most a single element. +The meaning of \tcode{x = $B$} is \tcode{x = t}, +where \tcode{t} is an invented temporary variable +declared and initialized as \tcode{T t = $B$}. -\item an assignment to an object of class type, in which case the initializer -list is passed as the argument to the assignment operator function selected by +\item +an assignment to an object of class type, in which case $B$ +is passed as the argument to the assignment operator function selected by overload resolution\iref{over.ass,over.match}. \end{itemize} + \begin{example} \begin{codeblock} complex z; From 155e16385f3d4095ffd4136aafddb27897c9e3bc Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 16:35:17 -0800 Subject: [PATCH 097/181] CWG2772 Missing Annex C entry for linkage effects of linkage-specification --- source/compatibility.tex | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/compatibility.tex b/source/compatibility.tex index 8de5989e0c..6211e42427 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -1826,6 +1826,27 @@ revision of \Cpp{} because \tcode{double} to \tcode{int} is a narrowing conversion. +\diffref{dcl.link} +\change +Names declared in an anonymous namespace +changed from external linkage to internal linkage; +language linkage applies to names with external linkage only. +\rationale +Alignment with user expectations. +\effect +Valid \CppIII{} code may violate the one-definition rule\iref{basic.def.odr} +in this revision of \Cpp{}. +For example: +\begin{codeblock} +namespace { extern "C" { extern int x; } } // \#1, previously external linkage and C language linkage, + // now internal linkage and \Cpp{} language linkage +namespace A { extern "C" int x = 42; } // \#2, external linkage and C language linkage +int main(void) { return x; } +\end{codeblock} +This code is valid in \CppIII{}, +but \tcode{\#2} is not a definition for \tcode{\#1} +in this revision of \Cpp{}, violating the one-definition rule. + \rSec2[diff.cpp03.class]{\ref{class}: classes} \diffref{class.default.ctor,class.dtor,class.copy.ctor,class.copy.assign} From 8ded3709b58fb559221cd7b49e3f754ca2c7c55f Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 16:36:42 -0800 Subject: [PATCH 098/181] CWG2780 reinterpret_cast to reference to function types --- source/expressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index 091a2f4242..58d8a2485d 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -4364,7 +4364,7 @@ \indextext{cast!reference}% \indextext{type pun}% A glvalue of type \tcode{T1}, -designating an object \placeholder{x}, +designating an object or function \placeholder{x}, can be cast to the type ``reference to \tcode{T2}'' if an expression of type ``pointer to \tcode{T1}'' can be explicitly converted to the type ``pointer to \tcode{T2}'' From 8f3ada93dee154c96e0e04e479d302f851ddcb51 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 16:45:06 -0800 Subject: [PATCH 099/181] CWG2783 Handling of deduction guides in global-module-fragment --- source/modules.tex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/modules.tex b/source/modules.tex index acb04fb625..52873a37ae 100644 --- a/source/modules.tex +++ b/source/modules.tex @@ -662,6 +662,9 @@ a partial or explicit specialization or an implicit or explicit instantiation of that template, or \item +$M$ declares a class template +and $D$ is a deduction guide for that template, or +\item one of $D$ and $M$ declares a class or enumeration type and the other introduces a typedef name for linkage purposes for that type. \end{itemize} From 05ac6f70f3df5d6dcd0121806e40d18f02c3b2bf Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 16:47:30 -0800 Subject: [PATCH 100/181] CWG2785 Type-dependence of requires-expression --- source/templates.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/templates.tex b/source/templates.tex index c1f766767a..41e30cc574 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -5195,7 +5195,8 @@ \opt{\terminal{::}} \keyword{delete} cast-expression\br \opt{\terminal{::}} \keyword{delete} \terminal{[} \terminal{]} cast-expression\br \keyword{throw} \opt{assignment-expression}\br -\keyword{noexcept} \terminal{(} expression \terminal{)} +\keyword{noexcept} \terminal{(} expression \terminal{)}\br +requires-expression \end{ncsimplebnf} \begin{note} From 520aa07652ff831869ccaace0dca0eee6617356f Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 17:06:12 -0800 Subject: [PATCH 101/181] CWG2789 Overload resolution with implicit and explicit object member functions --- source/overloading.tex | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/source/overloading.tex b/source/overloading.tex index 92deb259d2..f46353518e 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -1786,10 +1786,35 @@ or, if not that, \item -\tcode{F1} and \tcode{F2} are non-template functions with the same -parameter-type-lists, and \tcode{F1} is more constrained than \tcode{F2} +\tcode{F1} and \tcode{F2} are non-template functions and +\begin{itemize} +\item +they have the same non-object-parameter-type-lists\iref{dcl.fct}, and +\item +if they are member functions, both are direct members of the same class, and +\item +if both are non-static member functions, +they have the same types for their object parameters, and +\item +\tcode{F1} is more constrained than \tcode{F2} according to the partial ordering of constraints described in -\ref{temp.constr.order}, or if not that, +\ref{temp.constr.order}, +\end{itemize} +or if not that, +\begin{example} +\begin{codeblock} +template +struct S { + constexpr void f(); // \#1 + constexpr void f(this S&) requires true; // \#2 +}; + +void test() { + S<> s; + s.f(); // calls \#2 +} +\end{codeblock} +\end{example} \item \tcode{F1} is a constructor for a class \tcode{D}, From 17cef3aebbc108ed8279b13ddbf054ecdef41d14 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 17:16:40 -0800 Subject: [PATCH 102/181] CWG2791 Unclear phrasing about "returning to the caller" --- source/declarations.tex | 2 +- source/expressions.tex | 2 ++ source/statements.tex | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index af9a1f875b..ee1e6af4c9 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6763,7 +6763,7 @@ the \tcode{::operator new(size_t, nothrow_t)} form is used. The allocation function used in this case shall have a non-throwing \grammarterm{noexcept-specifier}. -If the allocation function returns \keyword{nullptr}, the coroutine returns +If the allocation function returns \keyword{nullptr}, the coroutine transfers control to the caller of the coroutine and the return value is obtained by a call to \tcode{T::get_return_object_on_allocation_failure()}, where \tcode{T} is the promise type. diff --git a/source/expressions.tex b/source/expressions.tex index 58d8a2485d..38c4b2201c 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -4747,6 +4747,8 @@ The \keyword{co_await} expression is used to suspend evaluation of a coroutine\iref{dcl.fct.def.coroutine} while awaiting completion of the computation represented by the operand expression. +Suspending the evaluation of a coroutine +transfers control to its caller or resumer. \begin{bnf} \nontermdef{await-expression}\br diff --git a/source/statements.tex b/source/statements.tex index e255195234..70d713e9ef 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -846,7 +846,7 @@ \indextext{function return|see{\tcode{return}}}% \pnum -A function returns to its caller by the \tcode{return} statement. +A function returns control to its caller by the \tcode{return} statement. \pnum The \grammarterm{expr-or-braced-init-list} @@ -915,8 +915,8 @@ \end{bnf} \pnum -A coroutine returns to its caller or resumer\iref{dcl.fct.def.coroutine} -by the \keyword{co_return} statement or when suspended\iref{expr.await}. +A \keyword{co_return} statement transfers control to +the caller or resumer of a coroutine\iref{dcl.fct.def.coroutine}. A coroutine shall not enclose a \tcode{return} statement\iref{stmt.return}. \begin{note} From 084900dc35784515e47c5997fac417bb1001e109 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 17:34:46 -0800 Subject: [PATCH 103/181] CWG2792 Clean up specification of noexcept operator --- source/expressions.tex | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 38c4b2201c..a403acc898 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -5053,31 +5053,29 @@ \rSec3[expr.unary.noexcept]{\tcode{noexcept} operator} -\pnum \indextext{\idxcode{noexcept}}% \indextext{expression!\idxcode{noexcept}}% -The \keyword{noexcept} operator determines whether the evaluation of its operand, -which is an unevaluated operand\iref{term.unevaluated.operand}, can throw an -exception\iref{except.throw}. \begin{bnf} \nontermdef{noexcept-expression}\br \keyword{noexcept} \terminal{(} expression \terminal{)} \end{bnf} +\pnum +The operand of the \keyword{noexcept} operator +is an unevaluated operand\iref{expr.context}. +If the operand is a prvalue, +the temporary materialization conversion\iref{conv.rval} is applied. + \pnum The result of the \keyword{noexcept} operator is a prvalue of type \keyword{bool}. +The result is \tcode{false} if +the full-expression of the operand is potentially-throwing\iref{except.spec}, and +\tcode{true} otherwise. \begin{note} A \grammarterm{noexcept-expression} is an integral constant expression\iref{expr.const}. \end{note} - -\pnum -If the operand is a prvalue, -the temporary materialization conversion\iref{conv.rval} is applied. -The result of the \keyword{noexcept} operator is \keyword{true} -unless the full-expression of the operand -is potentially-throwing\iref{except.spec}. \indextext{expression!unary|)} \rSec3[expr.new]{New} From 31ff2011667bad085f95ed418d6a359a3e860c66 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Thu, 16 Nov 2023 17:31:00 -0800 Subject: [PATCH 104/181] [expr.unary.noexcept] Fix reference to "unevaluated operand" added in CWG2792. --- source/expressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index a403acc898..6022416583 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -5063,7 +5063,7 @@ \pnum The operand of the \keyword{noexcept} operator -is an unevaluated operand\iref{expr.context}. +is an unevaluated operand\iref{term.unevaluated.operand}. If the operand is a prvalue, the temporary materialization conversion\iref{conv.rval} is applied. From 6fc65d534743ff98f8929a44fb138d980e6aae3c Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 17:37:43 -0800 Subject: [PATCH 105/181] CWG2793 Block-scope declaration conflicting with parameter name --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index 088f531817..f41c45d7c9 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -1290,7 +1290,7 @@ \pnum If a declaration that is not a name-independent declaration and -whose target scope is the block scope $S$ of a +that binds a name in the block scope $S$ of a \begin{itemize} \item \grammarterm{compound-statement} of a \grammarterm{lambda-expression}, From 15f7b2333f0e947e43fb6a30a5d53f812aabb72a Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 17:42:38 -0800 Subject: [PATCH 106/181] CWG2795 Overlapping empty subobjects with different cv-qualification --- source/basic.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index f41c45d7c9..3d192de98f 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3329,7 +3329,7 @@ may have the same address if \begin{itemize} \item one is nested within the other, -\item at least one is a subobject of zero size and they are of different types, +\item at least one is a subobject of zero size and they are not of similar types\iref{conv.qual}, or \item they are both potentially non-unique objects; \end{itemize} From 4cba24d41c71c1a0fe90cceaace588380df54c6e Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 17:45:47 -0800 Subject: [PATCH 107/181] CWG2796 Function pointer conversions for relational operators --- source/expressions.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 6022416583..dbb5184176 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -6553,8 +6553,10 @@ \pnum The usual arithmetic conversions\iref{expr.arith.conv} are performed on operands of arithmetic -or enumeration type. If both operands are pointers, pointer -conversions\iref{conv.ptr} and qualification conversions\iref{conv.qual} +or enumeration type. If both operands are pointers, +pointer conversions\iref{conv.ptr}, +function pointer conversions\iref{conv.fctptr}, and +qualification conversions\iref{conv.qual} are performed to bring them to their composite pointer type\iref{expr.type}. After conversions, the operands shall have the same type. From 55016c211bf8136dc7c42876bf4761e4e965f99b Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 17:52:04 -0800 Subject: [PATCH 108/181] CWG2798 Manifestly constant evaluation of the static_assert message --- source/declarations.tex | 4 ++-- source/expressions.tex | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index ee1e6af4c9..5aff1e21f5 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -77,7 +77,7 @@ \begin{bnf} \nontermdef{static_assert-message}\br unevaluated-string\br - conditional-expression + constant-expression \end{bnf} \begin{bnf} @@ -291,7 +291,7 @@ the program is ill-formed, and \item if the \grammarterm{static_assert-message} is -a \grammarterm{conditional-expression} $M$, +a \grammarterm{constant-expression} $M$, \begin{itemize} \item \tcode{$M$.size()} shall be a converted constant expression of diff --git a/source/expressions.tex b/source/expressions.tex index dbb5184176..07482471d8 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -8099,7 +8099,8 @@ \end{example} \end{itemize} \begin{note} -A manifestly constant-evaluated expression +Except for a \grammarterm{static_assert-message}, +a manifestly constant-evaluated expression is evaluated even in an unevaluated operand\iref{term.unevaluated.operand}. \end{note} From 7cb9798c343bce67cb1a59796aee19ecc3fcdd4d Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 18:00:28 -0800 Subject: [PATCH 109/181] CWG2801 Reference binding with reference-related types --- source/declarations.tex | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 5aff1e21f5..28052cbe15 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -5670,11 +5670,10 @@ \end{example} \item -Otherwise: +Otherwise, \tcode{T1} shall not be reference-related to \tcode{T2}. \begin{itemize} \item -If \tcode{T1} or \tcode{T2} is a class type and -\tcode{T1} is not reference-related to \tcode{T2}, +If \tcode{T1} or \tcode{T2} is a class type, user-defined conversions are considered using the rules for copy-initialization of an object of type ``\cvqual{cv1} \tcode{T1}'' by @@ -5693,24 +5692,6 @@ and the reference is bound to the result. \end{itemize} -If -\tcode{T1} -is reference-related to -\tcode{T2}: -\begin{itemize} -\item -\cvqual{cv1} -shall be the same cv-qualification as, or greater cv-qualification than, -\cvqual{cv2}; and -\item -if the reference is an rvalue reference, -the initializer expression shall not be an lvalue. -\begin{note} -This can be affected by -whether the initializer expression is move-eligible\iref{expr.prim.id.unqual}. -\end{note} -\end{itemize} - \begin{example} \begin{codeblock} struct Banana { }; From 81f6035aa6e86c92e753b0de528941a780d0b978 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 18:04:57 -0800 Subject: [PATCH 110/181] CWG2806 Make a type-requirement a type-only context --- source/expressions.tex | 2 ++ source/templates.tex | 1 + 2 files changed, 3 insertions(+) diff --git a/source/expressions.tex b/source/expressions.tex index 07482471d8..5977502d1e 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -2942,6 +2942,8 @@ \pnum A \grammarterm{type-requirement} asserts the validity of a type. +The component names of a \grammarterm{type-requirement} are those of its +\grammarterm{nested-name-specifier} (if any) and \grammarterm{type-name}. \begin{note} The enclosing \grammarterm{requires-expression} will evaluate to \keyword{false} if substitution of template arguments fails. diff --git a/source/templates.tex b/source/templates.tex index 41e30cc574..40c190ffcb 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -4355,6 +4355,7 @@ \begin{itemize} \item a \grammarterm{typename-specifier}, +\grammarterm{type-requirement}, \grammarterm{nested-name-specifier}, \grammarterm{elaborated-type-specifier}, \grammarterm{class-or-decltype}, or From 544c15f176147ff82c72ad7e611d8f842e2c7035 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 18:06:50 -0800 Subject: [PATCH 111/181] CWG2807 Destructors declared consteval --- source/classes.tex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 2d033e48c9..bd64e8f84d 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -1986,9 +1986,8 @@ shall be \keyword{friend}, \keyword{inline}, -\keyword{virtual}, -\keyword{constexpr}, or -\keyword{consteval}. +\keyword{virtual}, or +\keyword{constexpr}. \pnum \indextext{generated destructor|see{destructor, default}}% From 4fb5ad346f93ddcd35ccc578deb30f2d7690b32f Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 13 Nov 2023 18:09:49 -0800 Subject: [PATCH 112/181] CWG2823 Implicit undefined behavior when dereferencing pointers --- source/expressions.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 5977502d1e..4f1f899481 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -4560,8 +4560,10 @@ \indextext{dereferencing|see{indirection}}% Its operand shall be a prvalue of type ``pointer to \tcode{T}'', where \tcode{T} is an object or function type. -The operator yields an lvalue of type \tcode{T} -denoting the object or function to which the operand points. +The operator yields an lvalue of type \tcode{T}. +If the operand points to an object or function, +the result denotes that object or function; +otherwise, the behavior is undefined except as specified in \ref{expr.typeid}. \begin{note} \indextext{type!incomplete}% Indirection through a pointer to an incomplete type (other than From 97ca5cf30632254223f33151c41528992e2e1e97 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Wed, 15 Nov 2023 21:45:38 +0100 Subject: [PATCH 113/181] P2308R1 Template parameter initialization --- source/declarations.tex | 5 +- source/templates.tex | 217 ++++++++++++++++++++++------------------ 2 files changed, 120 insertions(+), 102 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 28052cbe15..bfdc5b166f 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -4027,9 +4027,7 @@ of a function declaration or \grammarterm{lambda-declarator} or in a -\grammarterm{template-parameter}\iref{temp.param}; -in the latter case, the \grammarterm{initializer-clause} shall be an -\grammarterm{assignment-expression}. +\grammarterm{template-parameter}\iref{temp.param}. A default argument shall not be specified for a template parameter pack or a function parameter pack. @@ -5761,6 +5759,7 @@ \item in a \tcode{return} statement\iref{stmt.return} \item as a \grammarterm{for-range-initializer}\iref{stmt.iter} \item as a function argument\iref{expr.call} +\item as a template argument\iref{temp.arg.nontype} \item as a subscript\iref{expr.sub} \item as an argument to a constructor invocation\iref{dcl.init,expr.type.conv} \item as an initializer for a non-static data member\iref{class.mem} diff --git a/source/templates.tex b/source/templates.tex index 40c190ffcb..954f7b61a6 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -411,12 +411,11 @@ a non-type \grammarterm{template-parameter} of class type \tcode{T} denotes a static storage duration object of type \tcode{const T}, known as a \defn{template parameter object}, -whose value is that of the corresponding template argument +which is template-argument-equivalent\iref{temp.type} to +the corresponding template argument after it has been converted -to the type of the \grammarterm{template-parameter}. -All such template parameters in the program of the same type -with the same value denote the same template parameter object. -A template parameter object shall have constant destruction\iref{expr.const}. +to the type of the \grammarterm{template-parameter}\iref{temp.arg.nontype}. +No two template parameter objects are template-argument-equivalent. \begin{note} If an \grammarterm{id-expression} names a non-type non-reference \grammarterm{template-parameter}, @@ -483,40 +482,27 @@ for the invented type corresponding to the placeholder\iref{dcl.fct}. \pnum -A -\defnx{default template-argument}{\idxgram{template-argument}!default} -is a -\grammarterm{template-argument}\iref{temp.arg} specified after -\tcode{=} -in a -\grammarterm{template-parameter}. -A default -\grammarterm{template-argument} -may be specified for any kind of -\grammarterm{template-parameter} -(type, non-type, template) +A \defnadj{default}{template argument} is +a template argument \iref{temp.arg} specified after \tcode{=} +in a \grammarterm{template-parameter}. +A default template argument may be specified for +any kind of \grammarterm{template-parameter} (type, non-type, template) that is not a template parameter pack\iref{temp.variadic}. -A default -\grammarterm{template-argument} -may be specified in a template declaration. -A default -\grammarterm{template-argument} -shall not be specified in the -\grammarterm{template-parameter-list}{s} -of the definition of a member of a class template that appears outside -of the member's class. -A default -\grammarterm{template-argument} +A default template argument may be specified in a template declaration. +A default template argument shall not be specified in +the \grammarterm{template-parameter-list}{s} +of the definition of a member of a class template +that appears outside of the member's class. +A default template argument shall not be specified in a friend class template declaration. If a friend function template declaration $D$ -specifies a default \grammarterm{template-argument}, +specifies a default template argument, that declaration shall be a definition and there shall be no other declaration of the function template which is reachable from $D$ or from which $D$ is reachable. \pnum -The set of default -\grammarterm{template-argument}{s} +The set of default template arguments available for use is obtained by merging the default arguments from all prior declarations of the template in the same way default function arguments are\iref{dcl.fct.default}. @@ -532,29 +518,24 @@ \end{example} \pnum -If a -\grammarterm{template-parameter} -of a class template, variable template, or alias template has a default -\grammarterm{template-argument}, -each subsequent -\grammarterm{template-parameter} -shall either have a default -\grammarterm{template-argument} -supplied -or be a template parameter pack. If a \grammarterm{template-parameter} -of a primary class template, primary variable template, or alias template -is a template parameter pack, it shall be the last -\grammarterm{template-parameter}. -A template parameter pack of a function template shall not be followed by -another -template parameter unless that template parameter can be deduced from the -parameter-type-list\iref{dcl.fct} of the function template or has a -default argument\iref{temp.deduct}. +If a \grammarterm{template-parameter} +of a class template, variable template, or alias template has +a default template argument, +each subsequent \grammarterm{template-parameter} +shall either have a default template argument supplied or +be a template parameter pack. +If a \grammarterm{template-parameter} of +a primary class template, primary variable template, or alias template +is a template parameter pack, +it shall be the last \grammarterm{template-parameter}. +A template parameter pack of a function template +shall not be followed by another template parameter +unless that template parameter can be deduced from the +parameter-type-list\iref{dcl.fct} of the function template or +has a default argument\iref{temp.deduct}. A template parameter of a deduction guide template\iref{temp.deduct.guide} -that does not have a default argument -shall be deducible -from the parameter-type-list -of the deduction guide template. +that does not have a default argument shall be deducible +from the parameter-type-list of the deduction guide template. \begin{example} \begin{codeblock} template class B; // error @@ -567,15 +548,10 @@ \indextext{\idxcode{<}!template and}% \pnum -When parsing a -default -\grammarterm{template-argument} -for a non-type -\grammarterm{template-parameter}, -the first non-nested -\tcode{>} -is taken as the end of the -\grammarterm{template-parameter-list} +When parsing a default template argument +for a non-type \grammarterm{template-parameter}, +the first non-nested \tcode{>} is taken as +the end of the \grammarterm{template-parameter-list} rather than a greater-than operator. \begin{example} \begin{codeblock} @@ -588,16 +564,12 @@ \end{example} \pnum -A -\grammarterm{template-parameter} -of a template -\grammarterm{template-parameter} -is permitted to have a default -\grammarterm{template-argument}. -When such default arguments are specified, they apply to the template -\grammarterm{template-parameter} -in the scope of the template -\grammarterm{template-parameter}. +A \grammarterm{template-parameter} of +a template \grammarterm{template-parameter} +is permitted to have a default template argument. +When such default arguments are specified, +they apply to the template \grammarterm{template-parameter} +in the scope of the template \grammarterm{template-parameter}. \begin{example} \begin{codeblock} template