Skip to content

2022-11 CWG Motion 3 #5987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,11 @@
\item In each such definition, corresponding entities shall have the
same language linkage.

\item In each such definition,
const objects with static or thread storage duration
shall be constant-initialized if
the object is constant-initialized in any such definition.

\item In each such definition, the overloaded operators referred
to, the implicit calls to conversion functions, constructors, operator
new functions and operator delete functions, shall refer to the same
Expand Down Expand Up @@ -4661,9 +4666,14 @@
can be an array of unknown bound and therefore be incomplete at one
point in a translation unit and complete later on; the array types at
those two points (``array of unknown bound of \tcode{T}'' and ``array of
\tcode{N} \tcode{T}'') are different types. The type of a pointer to array of
unknown bound, or of a type defined by a \keyword{typedef} declaration to
be an array of unknown bound, cannot be completed.
\tcode{N} \tcode{T}'') are different types.
\begin{note}
The type of a pointer or reference to array of unknown bound
permanently points to or refers to an incomplete type.
An array of unknown bound named by a \keyword{typedef} declaration
permanently refers to an incomplete type.
In either case, the array type cannot be completed.
\end{note}
\begin{example}
\indextext{type!example of incomplete}%
\begin{codeblock}
Expand Down Expand Up @@ -5580,6 +5590,10 @@
\item
The constituent expression of an expression is that expression.
\item
The constituent expression of a conversion is
the corresponding implicit function call, if any, or
the converted expression otherwise.
\item
The constituent expressions of a \grammarterm{braced-init-list} or
of a (possibly parenthesized) \grammarterm{expression-list}
are the constituent expressions of the elements of the respective list.
Expand Down Expand Up @@ -5627,6 +5641,15 @@
Expressions appearing in the \grammarterm{compound-statement} of a \grammarterm{lambda-expression}
are not subexpressions of the \grammarterm{lambda-expression}.
\end{note}
The \defnadjx{potentially-evaluated}{subexpressions}{subexpression} of
an expression, conversion, or \grammarterm{initializer} $E$ are
\begin{itemize}
\item
the constituent expressions of $E$ and
\item
the subexpressions thereof that
are not subexpressions of a nested unevaluated operand\iref{term.unevaluated.operand}.
\end{itemize}

\pnum
A \defn{full-expression} is
Expand Down
5 changes: 5 additions & 0 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@
shall not directly or indirectly cause the implicit definition of a
defaulted default constructor for the enclosing class or the
exception specification of that constructor.
An immediate invocation\iref{expr.const} that
is a potentially-evaluated subexpression\iref{intro.execution}
of a default member initializer
is neither evaluated nor checked for whether it
is a constant expression at the point where the subexpression appears.

\pnum
A member shall not be declared with the \keyword{extern}
Expand Down
54 changes: 35 additions & 19 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1356,11 +1356,6 @@
class-key \opt{attribute-specifier-seq} \opt{nested-name-specifier} identifier\br
class-key simple-template-id\br
class-key nested-name-specifier \opt{\keyword{template}} simple-template-id\br
elaborated-enum-specifier
\end{bnf}

\begin{bnf}
\nontermdef{elaborated-enum-specifier}\br
\keyword{enum} \opt{nested-name-specifier} identifier
\end{bnf}

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

\pnum
An immediate invocation\iref{expr.const} that is not evaluated where
it appears\iref{dcl.fct.default,class.mem.general}
is evaluated and checked for whether it is
a constant expression at the point where
the enclosing \grammarterm{initializer} is used in
a function call, a constructor definition, or an aggregate initialization.

\pnum
An \grammarterm{initializer-clause} followed by an ellipsis is a
pack expansion\iref{temp.variadic}.
Expand Down Expand Up @@ -6192,35 +6200,33 @@

\pnum
An explicitly defaulted special member function $\tcode{F}_1$
with type $\tcode{T}_1$
is allowed to differ from
the corresponding special member function $\tcode{F}_2$
with type $\tcode{T}_2$
that would have been implicitly declared, as follows:
\begin{itemize}
\item
$\tcode{T}_1$ and $\tcode{T}_2$ may have differing \grammarterm{ref-qualifier}{s};
$\tcode{F}_1$ and $\tcode{F}_2$ may have differing \grammarterm{ref-qualifier}{s};
\item
if $\tcode{F}_2$ has an implicit object parameter of
type ``reference to \tcode{C}'',
$\tcode{F}_1$ may be an explicit object member function whose
explicit object parameter is of type ``reference to \tcode{C}'',
in which case $\tcode{T}_1$ would differ from $\tcode{T}_2$
in that $\tcode{T}_1$ has an additional parameter;
in which case the type of $\tcode{F}_1$ would differ from the type of $\tcode{F}_2$
in that the type of $\tcode{F}_1$ has an additional parameter;
\item
$\tcode{T}_1$ and $\tcode{T}_2$ may have differing exception specifications; and
$\tcode{F}_1$ and $\tcode{F}_2$ may have differing exception specifications; and
\item
if $\tcode{F}_2$ has a non-object parameter of type \tcode{const C\&},
the corresponding non-object parameter of $\tcode{F}_1$ may be of
type \tcode{C\&}.
\end{itemize}
If $\tcode{T}_1$ differs from $\tcode{T}_2$ in a way
If the type of $\tcode{F}_1$ differs from the type of $\tcode{F}_2$ in a way
other than as allowed by the preceding rules, then:
\begin{itemize}
\item
if $\tcode{F}_1$ is an assignment operator, and
the return type of $\tcode{T}_1$ differs from
the return type of $\tcode{T}_2$ or
the return type of $\tcode{F}_1$ differs from
the return type of $\tcode{F}_2$ or
$\tcode{F}_1${'s} non-object parameter type is not a reference,
the program is ill-formed;
\item
Expand Down Expand Up @@ -7161,13 +7167,23 @@

\begin{bnf}
\nontermdef{using-enum-declaration}\br
\terminal{using} elaborated-enum-specifier \terminal{;}
\keyword{using} \keyword{enum} using-enum-declarator \terminal{;}
\end{bnf}

\begin{bnf}
\nontermdef{using-enum-declarator}\br
\opt{nested-name-specifier} identifier\br
\opt{nested-name-specifier} simple-template-id
\end{bnf}

\pnum
The \grammarterm{elaborated-enum-specifier}
shall not name a dependent type
and the type shall have a reachable \grammarterm{enum-specifier}.
A \grammarterm{using-enum-declarator}
names the set of declarations found by
lookup\iref{basic.lookup.unqual,basic.lookup.qual}
for the \grammarterm{using-enum-declarator}.
The \grammarterm{using-enum-declarator}
shall designate a non-dependent type
with a reachable \grammarterm{enum-specifier}.

\pnum
A \grammarterm{using-enum-declaration}
Expand Down
11 changes: 4 additions & 7 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,7 @@
return x+2;
}(); // Updates \tcode{::x} to 6, and initializes \tcode{y} to 7.

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

\pnum
A constant-initialized potentially-constant variable $V$ is
Expand Down Expand Up @@ -7923,8 +7923,7 @@
or

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

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

\item
a variable named by a potentially constant evaluated expression
that is either a constexpr variable or
is of non-volatile const-qualified integral type or of reference type.
a potentially-constant variable named by a potentially constant evaluated expression.
\end{itemize}

\indextext{expression|)}
13 changes: 4 additions & 9 deletions source/overloading.tex
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,6 @@
When comparing the call against a
surrogate call function, the implied object argument is compared
against the first parameter of the surrogate call function.
The
conversion function from which the surrogate call function was
derived will be used in the conversion sequence for that
parameter since it converts the implied object argument to the
appropriate function pointer or reference required by that first
parameter.
\end{note}
\begin{example}
\begin{codeblock}
Expand Down Expand Up @@ -3418,11 +3412,12 @@
where the \grammarterm{postfix-expression} is of class type,
the operator function
is selected by overload resolution\iref{over.call.object}.
If a surrogate call function for a conversion function
named \keyword{operator} \grammarterm{conversion-type-id} is selected,
If a surrogate call function is selected,
let $e$ be the result of invoking the corresponding conversion operator function on the \grammarterm{postfix-expression};

the expression is interpreted as
\begin{ncsimplebnf}
postfix-expression \terminal{.} \keyword{operator} conversion-type-id \terminal{(}\terminal{)} \terminal{(} \opt{expression-list} \terminal{)}
$e$ \terminal{(} \opt{expression-list} \terminal{)}
\end{ncsimplebnf}
Otherwise, the expression is interpreted as
\begin{ncsimplebnf}
Expand Down
6 changes: 6 additions & 0 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5783,6 +5783,11 @@
\pnum
The contents of the header \libheaderdef{cstdarg} are the same as the C
standard library header \libheader{stdarg.h}, with the following changes:
\begin{itemize}
\item
In lieu of the default argument promotions specified in ISO C 6.5.2.2,
the definition in~\ref{expr.call} applies.
\item
The restrictions that ISO C places on the second parameter to the
\indexlibraryglobal{va_start}%
\tcode{va_start} macro in header \libheader{stdarg.h}
Expand All @@ -5808,6 +5813,7 @@
is of a reference type, or of a type that is not compatible with the
type that results when passing an argument for which there is no
parameter, the behavior is undefined.
\end{itemize}

\xrefc{7.16.1.1}

Expand Down
27 changes: 17 additions & 10 deletions source/templates.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5978,13 +5978,17 @@
It is unspecified whether or not an implementation implicitly instantiates a
virtual member function of a class template if the virtual member function would
not otherwise be instantiated.
The use of a template specialization in a default argument
shall not cause the template to be implicitly instantiated except that a
class template may be instantiated where its complete type is needed to determine
the correctness of the default argument.
The use of a template specialization in
a default argument or default member initializer
shall not cause the template to be implicitly instantiated except
where needed to determine
the correctness of the default argument or default member initializer.
The use of a default argument in a
function call causes specializations in the default argument to be implicitly
instantiated.
Similarly, the use of a default member initializer
in a constructor definition or an aggregate initialization
causes specializations in the default member initializer to be instantiated.

\pnum
If a function template
Expand Down Expand Up @@ -7325,9 +7329,11 @@
\begin{example}
\begin{codeblock}
template <class T, T> struct S {};
template <class T> int f(S<T, T()>*);
struct X {};
int i0 = f<X>(0);
template <class T> int f(S<T, T{}>*); // \#1
class X {
int m;
};
int i0 = f<X>(0); // \#1 uses a value of non-structural type \tcode{X} as a non-type template argument
\end{codeblock}
\end{example}

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

\pnum
If \tcode{P} is a reference type, the type referred to by \tcode{P} is used in place
Expand Down Expand Up @@ -7780,8 +7786,9 @@
(i.e., the type referred to by the reference).
\item
If the original \tcode{A} is
a function pointer or pointer-to-member-function type,
its \keyword{noexcept}.
a function pointer or pointer-to-member-function type
with a potentially-throwing exception specification\iref{except.spec},
the exception specification.
\item
Any cv-qualifiers in \tcode{A}
that can be restored by a qualification conversion.
Expand Down
11 changes: 5 additions & 6 deletions source/uax31.tex
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@
\rSec1[uaxid.pattern]{R3 Pattern_White_Space and Pattern_Syntax characters}

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

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

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

Expand Down