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 0001/1119] [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 0002/1119] [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 0003/1119] [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 0004/1119] [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 0005/1119] [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 0006/1119] [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 0007/1119] [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 0008/1119] [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 0009/1119] [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 0010/1119] [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 0011/1119] [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 0012/1119] [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 0013/1119] [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 0014/1119] [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 0015/1119] 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 0016/1119] 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 0017/1119] 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 0018/1119] 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 0019/1119] 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 0020/1119] 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 0021/1119] 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 0022/1119] 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 0023/1119] 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 0024/1119] 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 0025/1119] 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 0026/1119] 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 0027/1119] 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 0028/1119] 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 0029/1119] 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 0030/1119] 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 0031/1119] 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 0032/1119] [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 0033/1119] 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 0034/1119] 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 0035/1119] 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 0036/1119] 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 0037/1119] 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 0038/1119] 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 0039/1119] 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 0040/1119] 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 0041/1119] 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 0042/1119] 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 0043/1119] 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 0044/1119] 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 0045/1119] 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 0046/1119] 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 0047/1119] 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 0048/1119] 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 0049/1119] 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 0050/1119] [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 0051/1119] 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 0052/1119] 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 0053/1119] 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 0054/1119] 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 0055/1119] 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 0056/1119] 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 0057/1119] 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 0058/1119] 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 0059/1119] 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