From e7fb089f968caba096f2d49aade774aeea6b3ad8 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Feb 2022 19:08:18 +0100 Subject: [PATCH 1/7] CWG1726 Declarator operators and conversion function --- source/classes.tex | 52 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 59c0cedd8b..28fb507b5d 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -2472,8 +2472,6 @@ \indextext{fundamental type conversion|see{conversion, user-defined}}% \indextext{conversion!user-defined}% -\pnum -A member function of a class \tcode{X} with a name of the form \begin{bnf} \nontermdef{conversion-function-id}\br \keyword{operator} conversion-type-id @@ -2488,18 +2486,52 @@ \nontermdef{conversion-declarator}\br ptr-operator \opt{conversion-declarator} \end{bnf} -shall have no non-object parameters and -specifies a conversion from \tcode{X} to + +\pnum +A declaration +whose \grammarterm{declarator-id} has +an \grammarterm{unqualified-id} that is a \grammarterm{conversion-function-id} +declares a \defnadj{conversion}{function}; +its \grammarterm{declarator} shall be +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} +\end{ncsimplebnf} +where the \grammarterm{ptr-declarator} consists solely of +an \grammarterm{id-expression}, +an optional \grammarterm{attribute-specifier-seq}, and +optional surrounding parentheses, and +the \grammarterm{id-expression} has one of the following forms: +\begin{itemize} +\item +in a \grammarterm{member-declaration} that belongs to +the \grammarterm{member-specification} of a class or class template +but is not a friend declaration\iref{class.friend}, +the \grammarterm{id-expression} is a \grammarterm{conversion-function-id}; +\item +otherwise, the \grammarterm{id-expression} is a \grammarterm{qualified-id} +whose \grammarterm{unqualified-id} is a \grammarterm{conversion-function-id}. +\end{itemize} + +\pnum +A conversion function shall have no non-object parameters and +shall be a non-static member function of a class or class template \tcode{X}; +it specifies a conversion from \tcode{X} to the type specified by the \grammarterm{conversion-type-id}, interpreted as a \grammarterm{type-id}\iref{dcl.name}. -Such functions are called \defnx{conversion functions}{conversion function}. A \grammarterm{decl-specifier} in the \grammarterm{decl-specifier-seq} -of a conversion function (if any) shall be neither -a \grammarterm{defining-type-specifier} nor \keyword{static}. +of a conversion function (if any) shall not be +a \grammarterm{defining-type-specifier}. + +\pnum \indextext{conversion!type of}% -The type of the conversion function\iref{dcl.fct} is -``function taking no parameter returning -\grammarterm{conversion-type-id}''. +The type of the conversion function is +``\opt{\tcode{noexcept}} function taking no parameter +\opt{\grammarterm{cv-qualifier-seq}} \opt{\grammarterm{ref-qualifier}} +returning \grammarterm{conversion-type-id}''. + +\pnum A conversion function is never used to convert a (possibly cv-qualified) object to the (possibly cv-qualified) same object type (or a reference to it), to a (possibly cv-qualified) base class of that type (or a reference to it), From a53083bc9f055386d5125d415ca8e3c36d1ec615 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Tue, 15 Feb 2022 22:28:02 +0100 Subject: [PATCH 2/7] CWG2494 Multiple definitions of non-odr-used entities --- source/basic.tex | 49 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index dfd44e2ec6..b4fbc5b834 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -329,11 +329,22 @@ \indextext{enumerator!definition}% \indextext{one-definition rule|(}% +\pnum +Each of the following is termed a \defnadj{definable}{item}: +\begin{itemize} +\item a class type\iref{class}, +\item an enumeration type\iref{dcl.enum}, +\item a function\iref{dcl.fct}, +\item a variable\iref{basic.pre}, +\item a templated entity\iref{temp.pre}, +\item a default argument for a parameter +(for a function in a given scope)\iref{dcl.fct.default}, or +\item a default template argument\iref{temp.param}. +\end{itemize} + \pnum No translation unit shall contain more than one definition of any -variable, function, class type, enumeration type, template, -default argument for a parameter (for a function in a given scope), or -default template argument. +definable item. \pnum \indextext{expression!potentially evaluated}% @@ -527,7 +538,7 @@ \end{example} \pnum -Every program shall contain exactly one definition of every non-inline +Every program shall contain at least one definition of every function or variable that is odr-used in that program outside of a discarded statement\iref{stmt.if}; no diagnostic required. The definition can appear explicitly in the program, it can be found in @@ -611,20 +622,19 @@ \end{note} \pnum -There can be more than one definition of a +For any definable item \tcode{D} with definitions in multiple translation units, \begin{itemize} -\item class type\iref{class}, -\item enumeration type\iref{dcl.enum}, -\item inline function or variable\iref{dcl.inline}, -\item templated entity\iref{temp.pre}, -\item default argument for a parameter (for a function in a given scope)% -\iref{dcl.fct.default}, or -\item default template argument\iref{temp.param} +\item +if \tcode{D} is a non-inline non-templated function or variable, or +\item +if the definitions in different translation units +do not satisfy the following requirements, \end{itemize} -in a program provided that -each definition appears in a different translation unit and -the definitions satisfy the following requirements. -Given such an entity \tcode{D} defined in more than one translation unit, +the program is ill-formed; +a diagnostic is required only +if the definable item is attached to a named module and +a prior definition is reachable at the point where a later definition occurs. +Given such an item, for all definitions of \tcode{D}, or, if \tcode{D} is an unnamed enumeration, for all definitions of \tcode{D} that are reachable at any given program point, @@ -745,13 +755,6 @@ might still denote different types in different translation units. \end{note} -\pnum -If these definitions do not satisfy these requirements, -then the program is ill-formed; -a diagnostic is required only if -the entity is attached to a named module and -a prior definition is reachable at the point where a later definition occurs. - \pnum \begin{example} \begin{codeblock} From bd7606cfe60c2063edf1c314e403f9b169a4f877 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Feb 2022 19:57:22 +0100 Subject: [PATCH 3/7] CWG2499 Inconsistency in definition of pointer-interconvertibility --- source/basic.tex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index b4fbc5b834..e33f332139 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -5182,8 +5182,7 @@ the other is a non-static data member of that object\iref{class.union}, or \item one is a standard-layout class object and -the other is the first non-static data member of that object, or, -if the object has no non-static data members, +the other is the first non-static data member of that object or any base class subobject of that object\iref{class.mem}, or \item there exists an object \placeholder{c} such that From d2c8bd8de2c6235db292fa0e22d439cb2eedb846 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Feb 2022 20:00:56 +0100 Subject: [PATCH 4/7] CWG2502 Unintended declaration conflicts in nested statement scopes --- source/basic.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/basic.tex b/source/basic.tex index e33f332139..3445633caa 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -1225,7 +1225,8 @@ \grammarterm{compound-statement} of a \grammarterm{lambda-expression}, \grammarterm{function-body}, or \grammarterm{function-try-block}, \item -substatement of a selection or iteration statement, or +substatement of a selection or iteration statement +that is not itself a selection or iteration statement, or \item \grammarterm{handler} of a \grammarterm{function-try-block} \end{itemize} From dc697e52e8bbfd1d4d189386a07bdc19b4517192 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Feb 2022 20:04:46 +0100 Subject: [PATCH 5/7] CWG2506 Structured bindings and array cv-qualifiers --- source/declarations.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/declarations.tex b/source/declarations.tex index 02fcaaa862..d4026574ea 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6714,7 +6714,7 @@ see~\ref{depr.volatile.type}. First, a variable with a unique name \exposid{e} is introduced. If the \grammarterm{assignment-expression} in the \grammarterm{initializer} -has array type \tcode{A} and no \grammarterm{ref-qualifier} is present, +has array type \cvqual{cv1} \tcode{A} and no \grammarterm{ref-qualifier} is present, \exposid{e} is defined by \begin{ncbnf} \opt{attribute-specifier-seq} \placeholder{S} \cv{} \terminal{A} \exposid{e} \terminal{;} From 0fbb2f2e9c0d72c4a43891a135ff283f9bf7e054 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Feb 2022 20:55:14 +0100 Subject: [PATCH 6/7] CWG2509 decl-specifier-seq in lambda-specifiers --- source/expressions.tex | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 42a18a9d04..59461a20e2 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -1690,7 +1690,20 @@ \begin{bnf} \nontermdef{lambda-specifiers}\br - \opt{decl-specifier-seq} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \opt{trailing-return-type} + \opt{lambda-specifier-seq} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \opt{trailing-return-type} +\end{bnf} + +\begin{bnf} +\nontermdef{lambda-specifier}\br + \keyword{consteval}\br + \keyword{constexpr}\br + \keyword{mutable} +\end{bnf} + +\begin{bnf} +\nontermdef{lambda-specifier-seq}\br + lambda-specifier\br + lambda-specifier lambda-specifier-seq \end{bnf} \pnum @@ -1715,12 +1728,12 @@ \end{note} \pnum -In the \grammarterm{decl-specifier-seq} of the \grammarterm{lambda-declarator}, -each \grammarterm{decl-specifier} -shall be one of \keyword{mutable}, \keyword{constexpr}, or \keyword{consteval}. +A \grammarterm{lambda-specifier-seq} +shall contain at most one of each \grammarterm{lambda-specifier} and +shall not contain both \keyword{constexpr} and \keyword{consteval}. If the \grammarterm{lambda-declarator} contains an explicit object parameter\iref{dcl.fct}, -then no \grammarterm{decl-specifier} in the \grammarterm{decl-specifier-seq} +then no \grammarterm{lambda-specifier} in the \grammarterm{lambda-specifier-seq} shall be \keyword{mutable}. \begin{note} The trailing \grammarterm{requires-clause} is described in \ref{dcl.decl}. From e941a31b9005efd5ad0ab2d71bf9ab18c4cd352e Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Feb 2022 21:05:48 +0100 Subject: [PATCH 7/7] CWG2511 cv-qualified bit-fields --- source/classes.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/classes.tex b/source/classes.tex index 28fb507b5d..e2103e4fe9 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -2815,7 +2815,7 @@ to the entity being declared. A bit-field shall not be a static member. \indextext{bit-field!type of}% -A bit-field shall have integral or enumeration type; +A bit-field shall have integral or (possibly cv-qualified) enumeration type; the bit-field semantic property is not part of the type of the class member. The \grammarterm{constant-expression} shall be an integral constant expression with a value greater than or equal to zero and