Skip to content

Commit 21dc0d3

Browse files
authored
Merge 2022-02 CWG Motion 1
P2533R0 Core Language Working Group "ready" Issues for the February, 2022 Meeting
2 parents 4b1a735 + e941a31 commit 21dc0d3

File tree

4 files changed

+91
-43
lines changed

4 files changed

+91
-43
lines changed

source/basic.tex

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,22 @@
329329
\indextext{enumerator!definition}%
330330
\indextext{one-definition rule|(}%
331331

332+
\pnum
333+
Each of the following is termed a \defnadj{definable}{item}:
334+
\begin{itemize}
335+
\item a class type\iref{class},
336+
\item an enumeration type\iref{dcl.enum},
337+
\item a function\iref{dcl.fct},
338+
\item a variable\iref{basic.pre},
339+
\item a templated entity\iref{temp.pre},
340+
\item a default argument for a parameter
341+
(for a function in a given scope)\iref{dcl.fct.default}, or
342+
\item a default template argument\iref{temp.param}.
343+
\end{itemize}
344+
332345
\pnum
333346
No translation unit shall contain more than one definition of any
334-
variable, function, class type, enumeration type, template,
335-
default argument for a parameter (for a function in a given scope), or
336-
default template argument.
347+
definable item.
337348

338349
\pnum
339350
\indextext{expression!potentially evaluated}%
@@ -527,7 +538,7 @@
527538
\end{example}
528539

529540
\pnum
530-
Every program shall contain exactly one definition of every non-inline
541+
Every program shall contain at least one definition of every
531542
function or variable that is odr-used in that program
532543
outside of a discarded statement\iref{stmt.if}; no diagnostic required.
533544
The definition can appear explicitly in the program, it can be found in
@@ -611,20 +622,19 @@
611622
\end{note}
612623

613624
\pnum
614-
There can be more than one definition of a
625+
For any definable item \tcode{D} with definitions in multiple translation units,
615626
\begin{itemize}
616-
\item class type\iref{class},
617-
\item enumeration type\iref{dcl.enum},
618-
\item inline function or variable\iref{dcl.inline},
619-
\item templated entity\iref{temp.pre},
620-
\item default argument for a parameter (for a function in a given scope)%
621-
\iref{dcl.fct.default}, or
622-
\item default template argument\iref{temp.param}
627+
\item
628+
if \tcode{D} is a non-inline non-templated function or variable, or
629+
\item
630+
if the definitions in different translation units
631+
do not satisfy the following requirements,
623632
\end{itemize}
624-
in a program provided that
625-
each definition appears in a different translation unit and
626-
the definitions satisfy the following requirements.
627-
Given such an entity \tcode{D} defined in more than one translation unit,
633+
the program is ill-formed;
634+
a diagnostic is required only
635+
if the definable item is attached to a named module and
636+
a prior definition is reachable at the point where a later definition occurs.
637+
Given such an item,
628638
for all definitions of \tcode{D}, or,
629639
if \tcode{D} is an unnamed enumeration,
630640
for all definitions of \tcode{D} that are reachable at any given program point,
@@ -745,13 +755,6 @@
745755
might still denote different types in different translation units.
746756
\end{note}
747757

748-
\pnum
749-
If these definitions do not satisfy these requirements,
750-
then the program is ill-formed;
751-
a diagnostic is required only if
752-
the entity is attached to a named module and
753-
a prior definition is reachable at the point where a later definition occurs.
754-
755758
\pnum
756759
\begin{example}
757760
\begin{codeblock}
@@ -1222,7 +1225,8 @@
12221225
\grammarterm{compound-statement} of a \grammarterm{lambda-expression},
12231226
\grammarterm{function-body}, or \grammarterm{function-try-block},
12241227
\item
1225-
substatement of a selection or iteration statement, or
1228+
substatement of a selection or iteration statement
1229+
that is not itself a selection or iteration statement, or
12261230
\item
12271231
\grammarterm{handler} of a \grammarterm{function-try-block}
12281232
\end{itemize}
@@ -5179,8 +5183,7 @@
51795183
the other is a non-static data member of that object\iref{class.union}, or
51805184
\item
51815185
one is a standard-layout class object and
5182-
the other is the first non-static data member of that object, or,
5183-
if the object has no non-static data members,
5186+
the other is the first non-static data member of that object or
51845187
any base class subobject of that object\iref{class.mem}, or
51855188
\item
51865189
there exists an object \placeholder{c} such that

source/classes.tex

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,8 +2472,6 @@
24722472
\indextext{fundamental type conversion|see{conversion, user-defined}}%
24732473
\indextext{conversion!user-defined}%
24742474

2475-
\pnum
2476-
A member function of a class \tcode{X} with a name of the form
24772475
\begin{bnf}
24782476
\nontermdef{conversion-function-id}\br
24792477
\keyword{operator} conversion-type-id
@@ -2488,18 +2486,52 @@
24882486
\nontermdef{conversion-declarator}\br
24892487
ptr-operator \opt{conversion-declarator}
24902488
\end{bnf}
2491-
shall have no non-object parameters and
2492-
specifies a conversion from \tcode{X} to
2489+
2490+
\pnum
2491+
A declaration
2492+
whose \grammarterm{declarator-id} has
2493+
an \grammarterm{unqualified-id} that is a \grammarterm{conversion-function-id}
2494+
declares a \defnadj{conversion}{function};
2495+
its \grammarterm{declarator} shall be
2496+
a function declarator\iref{dcl.fct} of the form
2497+
\begin{ncsimplebnf}
2498+
ptr-declarator \terminal{(} parameter-declaration-clause \terminal{)} \opt{cv-qualifier-seq}\br
2499+
\bnfindent \opt{ref-qualifier-seq} \opt{noexcept-specifier} \opt{attribute-specifier-seq}
2500+
\end{ncsimplebnf}
2501+
where the \grammarterm{ptr-declarator} consists solely of
2502+
an \grammarterm{id-expression},
2503+
an optional \grammarterm{attribute-specifier-seq}, and
2504+
optional surrounding parentheses, and
2505+
the \grammarterm{id-expression} has one of the following forms:
2506+
\begin{itemize}
2507+
\item
2508+
in a \grammarterm{member-declaration} that belongs to
2509+
the \grammarterm{member-specification} of a class or class template
2510+
but is not a friend declaration\iref{class.friend},
2511+
the \grammarterm{id-expression} is a \grammarterm{conversion-function-id};
2512+
\item
2513+
otherwise, the \grammarterm{id-expression} is a \grammarterm{qualified-id}
2514+
whose \grammarterm{unqualified-id} is a \grammarterm{conversion-function-id}.
2515+
\end{itemize}
2516+
2517+
\pnum
2518+
A conversion function shall have no non-object parameters and
2519+
shall be a non-static member function of a class or class template \tcode{X};
2520+
it specifies a conversion from \tcode{X} to
24932521
the type specified by the \grammarterm{conversion-type-id},
24942522
interpreted as a \grammarterm{type-id}\iref{dcl.name}.
2495-
Such functions are called \defnx{conversion functions}{conversion function}.
24962523
A \grammarterm{decl-specifier} in the \grammarterm{decl-specifier-seq}
2497-
of a conversion function (if any) shall be neither
2498-
a \grammarterm{defining-type-specifier} nor \keyword{static}.
2524+
of a conversion function (if any) shall not be
2525+
a \grammarterm{defining-type-specifier}.
2526+
2527+
\pnum
24992528
\indextext{conversion!type of}%
2500-
The type of the conversion function\iref{dcl.fct} is
2501-
``function taking no parameter returning
2502-
\grammarterm{conversion-type-id}''.
2529+
The type of the conversion function is
2530+
``\opt{\tcode{noexcept}} function taking no parameter
2531+
\opt{\grammarterm{cv-qualifier-seq}} \opt{\grammarterm{ref-qualifier}}
2532+
returning \grammarterm{conversion-type-id}''.
2533+
2534+
\pnum
25032535
A conversion function is never used to convert a (possibly cv-qualified) object
25042536
to the (possibly cv-qualified) same object type (or a reference to it),
25052537
to a (possibly cv-qualified) base class of that type (or a reference to it),
@@ -2783,7 +2815,7 @@
27832815
to the entity being declared.
27842816
A bit-field shall not be a static member.
27852817
\indextext{bit-field!type of}%
2786-
A bit-field shall have integral or enumeration type;
2818+
A bit-field shall have integral or (possibly cv-qualified) enumeration type;
27872819
the bit-field semantic property is not part of the type of the class member.
27882820
The \grammarterm{constant-expression} shall be an integral constant expression
27892821
with a value greater than or equal to zero and

source/declarations.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6714,7 +6714,7 @@
67146714
see~\ref{depr.volatile.type}.
67156715
First, a variable with a unique name \exposid{e} is introduced. If the
67166716
\grammarterm{assignment-expression} in the \grammarterm{initializer}
6717-
has array type \tcode{A} and no \grammarterm{ref-qualifier} is present,
6717+
has array type \cvqual{cv1} \tcode{A} and no \grammarterm{ref-qualifier} is present,
67186718
\exposid{e} is defined by
67196719
\begin{ncbnf}
67206720
\opt{attribute-specifier-seq} \placeholder{S} \cv{} \terminal{A} \exposid{e} \terminal{;}

source/expressions.tex

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,20 @@
16901690

16911691
\begin{bnf}
16921692
\nontermdef{lambda-specifiers}\br
1693-
\opt{decl-specifier-seq} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \opt{trailing-return-type}
1693+
\opt{lambda-specifier-seq} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \opt{trailing-return-type}
1694+
\end{bnf}
1695+
1696+
\begin{bnf}
1697+
\nontermdef{lambda-specifier}\br
1698+
\keyword{consteval}\br
1699+
\keyword{constexpr}\br
1700+
\keyword{mutable}
1701+
\end{bnf}
1702+
1703+
\begin{bnf}
1704+
\nontermdef{lambda-specifier-seq}\br
1705+
lambda-specifier\br
1706+
lambda-specifier lambda-specifier-seq
16941707
\end{bnf}
16951708

16961709
\pnum
@@ -1715,12 +1728,12 @@
17151728
\end{note}
17161729

17171730
\pnum
1718-
In the \grammarterm{decl-specifier-seq} of the \grammarterm{lambda-declarator},
1719-
each \grammarterm{decl-specifier}
1720-
shall be one of \keyword{mutable}, \keyword{constexpr}, or \keyword{consteval}.
1731+
A \grammarterm{lambda-specifier-seq}
1732+
shall contain at most one of each \grammarterm{lambda-specifier} and
1733+
shall not contain both \keyword{constexpr} and \keyword{consteval}.
17211734
If the \grammarterm{lambda-declarator} contains
17221735
an explicit object parameter\iref{dcl.fct},
1723-
then no \grammarterm{decl-specifier} in the \grammarterm{decl-specifier-seq}
1736+
then no \grammarterm{lambda-specifier} in the \grammarterm{lambda-specifier-seq}
17241737
shall be \keyword{mutable}.
17251738
\begin{note}
17261739
The trailing \grammarterm{requires-clause} is described in \ref{dcl.decl}.

0 commit comments

Comments
 (0)