Skip to content

Commit 5b39c08

Browse files
authored
Merge 2022-11 CWG Motion 3
P2710R0 Core Language Working Group NB comment resolutions for the November, 2022 meeting; excluding issues 2615, 2639, 2640, 2652, 2653, 2654, and 2538 After consultation with CWG, the resolution for CWG2642 was not applied and has been returned to CWG for reconsideration.
2 parents 6dc4c98 + f9799b6 commit 5b39c08

8 files changed

+102
-54
lines changed

source/basic.tex

+26-3
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,11 @@
675675
\item In each such definition, corresponding entities shall have the
676676
same language linkage.
677677

678+
\item In each such definition,
679+
const objects with static or thread storage duration
680+
shall be constant-initialized if
681+
the object is constant-initialized in any such definition.
682+
678683
\item In each such definition, the overloaded operators referred
679684
to, the implicit calls to conversion functions, constructors, operator
680685
new functions and operator delete functions, shall refer to the same
@@ -4661,9 +4666,14 @@
46614666
can be an array of unknown bound and therefore be incomplete at one
46624667
point in a translation unit and complete later on; the array types at
46634668
those two points (``array of unknown bound of \tcode{T}'' and ``array of
4664-
\tcode{N} \tcode{T}'') are different types. The type of a pointer to array of
4665-
unknown bound, or of a type defined by a \keyword{typedef} declaration to
4666-
be an array of unknown bound, cannot be completed.
4669+
\tcode{N} \tcode{T}'') are different types.
4670+
\begin{note}
4671+
The type of a pointer or reference to array of unknown bound
4672+
permanently points to or refers to an incomplete type.
4673+
An array of unknown bound named by a \keyword{typedef} declaration
4674+
permanently refers to an incomplete type.
4675+
In either case, the array type cannot be completed.
4676+
\end{note}
46674677
\begin{example}
46684678
\indextext{type!example of incomplete}%
46694679
\begin{codeblock}
@@ -5580,6 +5590,10 @@
55805590
\item
55815591
The constituent expression of an expression is that expression.
55825592
\item
5593+
The constituent expression of a conversion is
5594+
the corresponding implicit function call, if any, or
5595+
the converted expression otherwise.
5596+
\item
55835597
The constituent expressions of a \grammarterm{braced-init-list} or
55845598
of a (possibly parenthesized) \grammarterm{expression-list}
55855599
are the constituent expressions of the elements of the respective list.
@@ -5627,6 +5641,15 @@
56275641
Expressions appearing in the \grammarterm{compound-statement} of a \grammarterm{lambda-expression}
56285642
are not subexpressions of the \grammarterm{lambda-expression}.
56295643
\end{note}
5644+
The \defnadjx{potentially-evaluated}{subexpressions}{subexpression} of
5645+
an expression, conversion, or \grammarterm{initializer} $E$ are
5646+
\begin{itemize}
5647+
\item
5648+
the constituent expressions of $E$ and
5649+
\item
5650+
the subexpressions thereof that
5651+
are not subexpressions of a nested unevaluated operand\iref{term.unevaluated.operand}.
5652+
\end{itemize}
56305653

56315654
\pnum
56325655
A \defn{full-expression} is

source/classes.tex

+5
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,11 @@
659659
shall not directly or indirectly cause the implicit definition of a
660660
defaulted default constructor for the enclosing class or the
661661
exception specification of that constructor.
662+
An immediate invocation\iref{expr.const} that
663+
is a potentially-evaluated subexpression\iref{intro.execution}
664+
of a default member initializer
665+
is neither evaluated nor checked for whether it
666+
is a constant expression at the point where the subexpression appears.
662667

663668
\pnum
664669
A member shall not be declared with the \keyword{extern}

source/declarations.tex

+35-19
Original file line numberDiff line numberDiff line change
@@ -1356,11 +1356,6 @@
13561356
class-key \opt{attribute-specifier-seq} \opt{nested-name-specifier} identifier\br
13571357
class-key simple-template-id\br
13581358
class-key nested-name-specifier \opt{\keyword{template}} simple-template-id\br
1359-
elaborated-enum-specifier
1360-
\end{bnf}
1361-
1362-
\begin{bnf}
1363-
\nontermdef{elaborated-enum-specifier}\br
13641359
\keyword{enum} \opt{nested-name-specifier} identifier
13651360
\end{bnf}
13661361

@@ -4009,7 +4004,12 @@
40094004
copy-initialization semantics\iref{dcl.init}.
40104005
The names in the
40114006
default argument are looked up, and the semantic constraints are checked,
4012-
at the point where the default argument appears.
4007+
at the point where the default argument appears, except that
4008+
an immediate invocation\iref{expr.const} that
4009+
is a potentially-evaluated subexpression\iref{intro.execution} of
4010+
the \grammarterm{initializer-clause} in a \grammarterm{parameter-declaration} is
4011+
neither evaluated
4012+
nor checked for whether it is a constant expression at that point.
40134013
Name lookup and checking of semantic constraints for default
40144014
arguments of templated functions are performed as described in~\ref{temp.inst}.
40154015
\begin{example}
@@ -4689,6 +4689,14 @@
46894689
\end{note}
46904690
\end{itemize}
46914691

4692+
\pnum
4693+
An immediate invocation\iref{expr.const} that is not evaluated where
4694+
it appears\iref{dcl.fct.default,class.mem.general}
4695+
is evaluated and checked for whether it is
4696+
a constant expression at the point where
4697+
the enclosing \grammarterm{initializer} is used in
4698+
a function call, a constructor definition, or an aggregate initialization.
4699+
46924700
\pnum
46934701
An \grammarterm{initializer-clause} followed by an ellipsis is a
46944702
pack expansion\iref{temp.variadic}.
@@ -6192,35 +6200,33 @@
61926200

61936201
\pnum
61946202
An explicitly defaulted special member function $\tcode{F}_1$
6195-
with type $\tcode{T}_1$
61966203
is allowed to differ from
61976204
the corresponding special member function $\tcode{F}_2$
6198-
with type $\tcode{T}_2$
61996205
that would have been implicitly declared, as follows:
62006206
\begin{itemize}
62016207
\item
6202-
$\tcode{T}_1$ and $\tcode{T}_2$ may have differing \grammarterm{ref-qualifier}{s};
6208+
$\tcode{F}_1$ and $\tcode{F}_2$ may have differing \grammarterm{ref-qualifier}{s};
62036209
\item
62046210
if $\tcode{F}_2$ has an implicit object parameter of
62056211
type ``reference to \tcode{C}'',
62066212
$\tcode{F}_1$ may be an explicit object member function whose
62076213
explicit object parameter is of type ``reference to \tcode{C}'',
6208-
in which case $\tcode{T}_1$ would differ from $\tcode{T}_2$
6209-
in that $\tcode{T}_1$ has an additional parameter;
6214+
in which case the type of $\tcode{F}_1$ would differ from the type of $\tcode{F}_2$
6215+
in that the type of $\tcode{F}_1$ has an additional parameter;
62106216
\item
6211-
$\tcode{T}_1$ and $\tcode{T}_2$ may have differing exception specifications; and
6217+
$\tcode{F}_1$ and $\tcode{F}_2$ may have differing exception specifications; and
62126218
\item
62136219
if $\tcode{F}_2$ has a non-object parameter of type \tcode{const C\&},
62146220
the corresponding non-object parameter of $\tcode{F}_1$ may be of
62156221
type \tcode{C\&}.
62166222
\end{itemize}
6217-
If $\tcode{T}_1$ differs from $\tcode{T}_2$ in a way
6223+
If the type of $\tcode{F}_1$ differs from the type of $\tcode{F}_2$ in a way
62186224
other than as allowed by the preceding rules, then:
62196225
\begin{itemize}
62206226
\item
62216227
if $\tcode{F}_1$ is an assignment operator, and
6222-
the return type of $\tcode{T}_1$ differs from
6223-
the return type of $\tcode{T}_2$ or
6228+
the return type of $\tcode{F}_1$ differs from
6229+
the return type of $\tcode{F}_2$ or
62246230
$\tcode{F}_1${'s} non-object parameter type is not a reference,
62256231
the program is ill-formed;
62266232
\item
@@ -7161,13 +7167,23 @@
71617167

71627168
\begin{bnf}
71637169
\nontermdef{using-enum-declaration}\br
7164-
\terminal{using} elaborated-enum-specifier \terminal{;}
7170+
\keyword{using} \keyword{enum} using-enum-declarator \terminal{;}
7171+
\end{bnf}
7172+
7173+
\begin{bnf}
7174+
\nontermdef{using-enum-declarator}\br
7175+
\opt{nested-name-specifier} identifier\br
7176+
\opt{nested-name-specifier} simple-template-id
71657177
\end{bnf}
71667178

71677179
\pnum
7168-
The \grammarterm{elaborated-enum-specifier}
7169-
shall not name a dependent type
7170-
and the type shall have a reachable \grammarterm{enum-specifier}.
7180+
A \grammarterm{using-enum-declarator}
7181+
names the set of declarations found by
7182+
lookup\iref{basic.lookup.unqual,basic.lookup.qual}
7183+
for the \grammarterm{using-enum-declarator}.
7184+
The \grammarterm{using-enum-declarator}
7185+
shall designate a non-dependent type
7186+
with a reachable \grammarterm{enum-specifier}.
71717187

71727188
\pnum
71737189
A \grammarterm{using-enum-declaration}

source/expressions.tex

+4-7
Original file line numberDiff line numberDiff line change
@@ -2358,7 +2358,7 @@
23582358
return x+2;
23592359
}(); // Updates \tcode{::x} to 6, and initializes \tcode{y} to 7.
23602360

2361-
auto z = [a = 42](int a) { return 1; }; // error: parameter and local variable have the same name
2361+
auto z = [a = 42](int a) { return 1; }; // error: parameter and conceptual local variable have the same name
23622362
auto counter = [i=0]() mutable -> decltype(i) { // OK, returns \tcode{int}
23632363
return i++;
23642364
};
@@ -7326,7 +7326,7 @@
73267326
\pnum
73277327
A variable is \defn{potentially-constant} if
73287328
it is constexpr or
7329-
it has reference or const-qualified integral or enumeration type.
7329+
it has reference or non-volatile const-qualified integral or enumeration type.
73307330

73317331
\pnum
73327332
A constant-initialized potentially-constant variable $V$ is
@@ -7923,8 +7923,7 @@
79237923
or
79247924

79257925
\item
7926-
a subexpression of one of the above
7927-
that is not a subexpression of a nested unevaluated operand\iref{term.unevaluated.operand}.
7926+
a potentially-evaluated subexpression\iref{intro.execution} of one of the above.
79287927
\end{itemize}
79297928

79307929
\indextext{function!needed for constant evaluation}%
@@ -7938,9 +7937,7 @@
79387937
that is potentially constant evaluated, or
79397938

79407939
\item
7941-
a variable named by a potentially constant evaluated expression
7942-
that is either a constexpr variable or
7943-
is of non-volatile const-qualified integral type or of reference type.
7940+
a potentially-constant variable named by a potentially constant evaluated expression.
79447941
\end{itemize}
79457942

79467943
\indextext{expression|)}

source/overloading.tex

+4-9
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,6 @@
579579
When comparing the call against a
580580
surrogate call function, the implied object argument is compared
581581
against the first parameter of the surrogate call function.
582-
The
583-
conversion function from which the surrogate call function was
584-
derived will be used in the conversion sequence for that
585-
parameter since it converts the implied object argument to the
586-
appropriate function pointer or reference required by that first
587-
parameter.
588582
\end{note}
589583
\begin{example}
590584
\begin{codeblock}
@@ -3418,11 +3412,12 @@
34183412
where the \grammarterm{postfix-expression} is of class type,
34193413
the operator function
34203414
is selected by overload resolution\iref{over.call.object}.
3421-
If a surrogate call function for a conversion function
3422-
named \keyword{operator} \grammarterm{conversion-type-id} is selected,
3415+
If a surrogate call function is selected,
3416+
let $e$ be the result of invoking the corresponding conversion operator function on the \grammarterm{postfix-expression};
3417+
34233418
the expression is interpreted as
34243419
\begin{ncsimplebnf}
3425-
postfix-expression \terminal{.} \keyword{operator} conversion-type-id \terminal{(}\terminal{)} \terminal{(} \opt{expression-list} \terminal{)}
3420+
$e$ \terminal{(} \opt{expression-list} \terminal{)}
34263421
\end{ncsimplebnf}
34273422
Otherwise, the expression is interpreted as
34283423
\begin{ncsimplebnf}

source/support.tex

+6
Original file line numberDiff line numberDiff line change
@@ -5783,6 +5783,11 @@
57835783
\pnum
57845784
The contents of the header \libheaderdef{cstdarg} are the same as the C
57855785
standard library header \libheader{stdarg.h}, with the following changes:
5786+
\begin{itemize}
5787+
\item
5788+
In lieu of the default argument promotions specified in ISO C 6.5.2.2,
5789+
the definition in~\ref{expr.call} applies.
5790+
\item
57865791
The restrictions that ISO C places on the second parameter to the
57875792
\indexlibraryglobal{va_start}%
57885793
\tcode{va_start} macro in header \libheader{stdarg.h}
@@ -5808,6 +5813,7 @@
58085813
is of a reference type, or of a type that is not compatible with the
58095814
type that results when passing an argument for which there is no
58105815
parameter, the behavior is undefined.
5816+
\end{itemize}
58115817

58125818
\xrefc{7.16.1.1}
58135819

source/templates.tex

+17-10
Original file line numberDiff line numberDiff line change
@@ -5978,13 +5978,17 @@
59785978
It is unspecified whether or not an implementation implicitly instantiates a
59795979
virtual member function of a class template if the virtual member function would
59805980
not otherwise be instantiated.
5981-
The use of a template specialization in a default argument
5982-
shall not cause the template to be implicitly instantiated except that a
5983-
class template may be instantiated where its complete type is needed to determine
5984-
the correctness of the default argument.
5981+
The use of a template specialization in
5982+
a default argument or default member initializer
5983+
shall not cause the template to be implicitly instantiated except
5984+
where needed to determine
5985+
the correctness of the default argument or default member initializer.
59855986
The use of a default argument in a
59865987
function call causes specializations in the default argument to be implicitly
59875988
instantiated.
5989+
Similarly, the use of a default member initializer
5990+
in a constructor definition or an aggregate initialization
5991+
causes specializations in the default member initializer to be instantiated.
59885992

59895993
\pnum
59905994
If a function template
@@ -7325,9 +7329,11 @@
73257329
\begin{example}
73267330
\begin{codeblock}
73277331
template <class T, T> struct S {};
7328-
template <class T> int f(S<T, T()>*);
7329-
struct X {};
7330-
int i0 = f<X>(0);
7332+
template <class T> int f(S<T, T{}>*); // \#1
7333+
class X {
7334+
int m;
7335+
};
7336+
int i0 = f<X>(0); // \#1 uses a value of non-structural type \tcode{X} as a non-type template argument
73317337
\end{codeblock}
73327338
\end{example}
73337339

@@ -7715,7 +7721,7 @@
77157721
(call it \tcode{A}) as described in~\ref{temp.deduct.type}.
77167722
If the \grammarterm{conversion-function-id} is constructed during
77177723
overload resolution\iref{over.match.funcs},
7718-
the following transformations apply.
7724+
the rules in the remainder of this subclause apply.
77197725

77207726
\pnum
77217727
If \tcode{P} is a reference type, the type referred to by \tcode{P} is used in place
@@ -7780,8 +7786,9 @@
77807786
(i.e., the type referred to by the reference).
77817787
\item
77827788
If the original \tcode{A} is
7783-
a function pointer or pointer-to-member-function type,
7784-
its \keyword{noexcept}.
7789+
a function pointer or pointer-to-member-function type
7790+
with a potentially-throwing exception specification\iref{except.spec},
7791+
the exception specification.
77857792
\item
77867793
Any cv-qualifiers in \tcode{A}
77877794
that can be restored by a qualification conversion.

source/uax31.tex

+5-6
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,13 @@
8585
\rSec1[uaxid.pattern]{R3 Pattern_White_Space and Pattern_Syntax characters}
8686

8787
\pnum
88-
UAX \#31 describes how languages that use or interpret patterns of characters,
89-
such as regular expressions or number formats,
90-
may describe that syntax with Unicode properties.
88+
UAX \#31 describes how formal languages
89+
such as computer languages should describe and implement
90+
their use of whitespace and syntactically significant characters
91+
during the processes of lexing and parsing.
9192

9293
\pnum
93-
\Cpp{} does not do this as part of the language,
94-
deferring to library components for such usage of patterns.
95-
This requirement does not apply to \Cpp{}.
94+
\Cpp{} does not claim conformance with this requirement.
9695

9796
\rSec1[uaxid.eqn]{R4 Equivalent normalized identifiers}
9897

0 commit comments

Comments
 (0)