Skip to content

[CWG 1] P2796R0 except issues 2518, 2521, 2659, 2674, 2678, and 2691 #6118

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 28 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6181a4e
CWG2072 Default argument instantiation for member functions of templates
burblebee Feb 12, 2023
4682d95
CWG2475 Object declarations of type cv void
burblebee Feb 12, 2023
de45c7c
CWG2478 Properties of explicit specializations of implicitly-instanti…
burblebee Feb 12, 2023
da1e3f9
CWG2483 Language linkage of static member functions
burblebee Feb 12, 2023
040d3c9
CWG2489 Storage provided by array of char
burblebee Feb 12, 2023
0b10921
CWG2516 Locus of enum-specifier or opaque-enum-declaration
burblebee Feb 12, 2023
7a947d7
CWG2517 Useless restriction on use of parameter in constraint-expression
burblebee Feb 12, 2023
8af88f7
CWG2520 Template signature and default template arguments
burblebee Feb 12, 2023
c755814
CWG2523 Undefined behavior via omitted destructor call in constant ex…
burblebee Feb 13, 2023
43cb1a4
CWG2526 Relational comparison of void* pointers
burblebee Feb 13, 2023
f428524
CWG2528 Three-way comparison and the usual arithmetic conversions
burblebee Feb 14, 2023
68330dc
CWG2529 Constant destruction of constexpr references
burblebee Feb 14, 2023
9859f3b
CWG2530 Multiple definitions of enumerators
burblebee Feb 14, 2023
60430bb
CWG2539 Three-way comparison requiring strong ordering for floating-p…
burblebee Feb 14, 2023
84ebbf7
CWG2543 constinit and optimized dynamic initialization
burblebee Feb 14, 2023
34ac2f4
CWG2558 Uninitialized subobjects as a result of an immediate invocation
burblebee Feb 14, 2023
ce7d8b0
CWG2602 consteval defaulted functions
burblebee Feb 14, 2023
4539636
CWG2642 Inconsistent use of T and C
burblebee Feb 14, 2023
e326276
CWG2658 Trivial copying of unions in core constant expressions
burblebee Feb 14, 2023
a78f644
CWG2662 Example for member access control vs. overload resolution
burblebee Feb 14, 2023
dbfffcc
CWG2664 Deduction failure in CTAD for alias templates
burblebee Feb 14, 2023
d487dc7
CWG2667 Named module imports do not import macros
burblebee Feb 14, 2023
d470e41
CWG2673 User-declared spaceship vs. built-in operators
burblebee Feb 14, 2023
8623a6a
CWG2681 Deducing member array type from string literal
burblebee Feb 14, 2023
9fa6c9e
CWG2682 Templated function vs. function template
burblebee Feb 14, 2023
e2fb7e3
CWG2685 Aggregate CTAD, string, and brace elision
burblebee Feb 14, 2023
224f6ba
CWG2690 Semantics of defaulted move assignment operator for unions
burblebee Feb 14, 2023
3225669
CWG2695 Semantic ignorability of attributes
burblebee Feb 14, 2023
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
37 changes: 21 additions & 16 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1083,10 +1083,12 @@
The locus of a \grammarterm{class-specifier} is immediately after
the \grammarterm{identifier} or \grammarterm{simple-template-id} (if any)
in its \grammarterm{class-head}\iref{class.pre}.
The locus of
an \grammarterm{enum-specifier} or \grammarterm{opaque-enum-declaration}
is immediately after the \grammarterm{identifier} (if any)
in it\iref{dcl.enum}.
The locus of an \grammarterm{enum-specifier}
is immediately after
its \grammarterm{enum-head};
the locus of an \grammarterm{opaque-enum-declaration}
is immediately after it\iref{dcl.enum}.
%FIXME: What's "it" below? What's "it" above?
The locus of an \grammarterm{alias-declaration} is immediately after it.

\pnum
Expand Down Expand Up @@ -1512,18 +1514,18 @@

\pnum
\indextext{scope!search}%
A \defn{search} in a scope $X$ for a name $N$ from a program point $P$
is a single search in $X$ for $N$ from $P$
A \defn{search} in a scope $X$ for a name $M$ from a program point $P$
is a single search in $X$ for $M$ from $P$
unless $X$ is the scope of a class or class template $T$, in which case the
following steps define the result of the search.
\begin{note}
The result differs only
if $N$ is a \grammarterm{conversion-function-id} or
if $M$ is a \grammarterm{conversion-function-id} or
if the single search would find nothing.
\end{note}

\pnum
The \defn{lookup set} for $N$ in $C$, called $S(N,C)$,
The \defn{lookup set} for a name $N$ in a class or class template $C$, called $S(N,C)$,
consists of two component sets:
the \term{declaration set}, a set of members named $N$; and
the \term{subobject set},
Expand All @@ -1548,10 +1550,10 @@
in each direct non-dependent\iref{temp.dep.type} base class subobject $B_i$, and
merge each such lookup set $S(N,B_i)$ in turn into $S(N,C)$.
\begin{note}
If $T$ is incomplete,
If $C$ is incomplete,
only base classes whose \grammarterm{base-specifier} appears before $P$
are considered.
If $T$ is an instantiated class, its base classes are not dependent.
If $C$ is an instantiated class, its base classes are not dependent.
\end{note}

\pnum
Expand All @@ -1577,9 +1579,9 @@
\end{itemize}

\pnum
The result of the search is the declaration set of $S(N,T)$.
The result of the search is the declaration set of $S(M,T)$.
If it is an invalid set, the program is ill-formed.
If it differs from the result of a search in $T$ for $N$
If it differs from the result of a search in $T$ for $M$
in a complete-class context\iref{class.mem} of $T$,
the program is ill-formed, no diagnostic required.
\begin{example}
Expand All @@ -1602,7 +1604,7 @@
\end{example}

\pnum
If $N$ is a non-dependent \grammarterm{conversion-function-id},
If $M$ is a non-dependent \grammarterm{conversion-function-id},
conversion function templates that are members of $T$ are considered.
For each such template $F$, the lookup set $S(t,T)$ is constructed,
considering a function template declaration to have the name $t$
Expand Down Expand Up @@ -3329,7 +3331,7 @@

\pnum
An operation that begins the lifetime of
an array of \tcode{char}, \tcode{unsigned char}, or \tcode{std::byte}
an array of \tcode{unsigned char} or \tcode{std::byte}
implicitly creates objects within the region of storage occupied by the array.
\begin{note}
The array object provides storage for these objects.
Expand Down Expand Up @@ -3407,8 +3409,11 @@
A \grammarterm{delete-expression}\iref{expr.delete} invokes the destructor
prior to releasing the storage.
\end{note}
In this case, the destructor is not implicitly invoked and any program that
depends on the side effects produced by the destructor has undefined behavior.
In this case, the destructor is not implicitly invoked.
\begin{note}
The correct behavior of a program often depends on
the destructor being invoked for each object of class type.
\end{note}

\pnum
Before the lifetime of an object has started but after the storage which
Expand Down
20 changes: 17 additions & 3 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@
\end{example}

\pnum
The implicitly-defined copy assignment operator for a
The implicitly-defined copy/move assignment operator for a
union \tcode{X} copies the object representation\iref{term.object.representation} of \tcode{X}.
If the source and destination of the assignment are not the same object, then
for each object nested within\iref{intro.object}
Expand Down Expand Up @@ -2095,7 +2095,7 @@

\pnum
A defaulted destructor is a constexpr destructor
if it satisfies the requirements for a constexpr function\iref{dcl.constexpr}.
if it is constexpr-suitable\iref{dcl.constexpr}.

\pnum
Before a
Expand Down Expand Up @@ -4270,6 +4270,19 @@
access control is applied to it, not to the declarations that replace it.
For an overload set, access control is applied only to
the function selected by overload resolution.
\begin{example}
\begin{codeblock}
struct S {
void f(int);
private:
void f(double);
};

void g(S* sp) {
sp->f(2); // OK, access control applied after overload resolution
}
\end{codeblock}
\end{example}
\begin{note}
Because access control applies to the declarations named, if access control is applied to a
\grammarterm{typedef-name}, only the accessibility of the typedef or alias declaration itself is considered.
Expand Down Expand Up @@ -6542,7 +6555,8 @@

\begin{itemize}
\item
If \tcode{a <=> b} is usable\iref{class.compare.default},
If \tcode{a <=> b} is usable\iref{class.compare.default} and
can be explicitly converted to \tcode{R} using \keyword{static_cast},
\tcode{static_cast<R>(a <=> b)}.

\item
Expand Down
71 changes: 44 additions & 27 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,28 @@

\pnum
If the \grammarterm{decl-specifier-seq} contains the \keyword{typedef}
specifier, the declaration is called a \defnx{typedef declaration}{declaration!typedef}
specifier, the declaration is a \defnx{typedef declaration}{declaration!typedef}
and each \grammarterm{declarator-id}
is declared to be a \grammarterm{typedef-name}, synonymous with its
associated type\iref{dcl.typedef}.
\begin{note}
Such a \grammarterm{declarator-id} is
an \grammarterm{identifier}\iref{class.conv.fct}.
\end{note}
If the
\grammarterm{decl-specifier-seq} contains no \keyword{typedef} specifier, the
declaration is called a \defnx{function declaration}{declaration!function} if
the type associated with a \grammarterm{declarator-id} is a function type\iref{dcl.fct} and
an \defnx{object declaration}{declaration!object} otherwise.
Otherwise, if the type associated with a \grammarterm{declarator-id}
is a function type\iref{dcl.fct},
the declaration is a \defnx{function declaration}{declaration!function}.
Otherwise, if the type associated with a \grammarterm{declarator-id}
is an object or reference type, the declaration is
an \defnx{object declaration}{declaration!object}.
Otherwise, the program is ill-formed.
\begin{example}
\begin{codeblock}
int f(), x; // OK, function declaration for \tcode{f} and object declaration for \tcode{x}
extern void g(), // OK, function declaration for \tcode{g}
y; // error: \tcode{void} is not an object type
\end{codeblock}
\end{example}

\pnum
\indextext{definition!declaration as}%
Expand Down Expand Up @@ -787,16 +796,17 @@
\pnum
\indextext{specifier!\idxcode{constexpr}!function}%
\indextext{constexpr function}%
The definition of a constexpr function shall satisfy the following
requirements:
A function is \defn{constexpr-suitable} if:
\begin{itemize}
\item
it shall not be a coroutine\iref{dcl.fct.def.coroutine};
it is not a coroutine\iref{dcl.fct.def.coroutine}, and

\item
if the function is a constructor or destructor,
its class shall not have any virtual base classes.
its class does not have any virtual base classes.
\end{itemize}
Except for instantiated constexpr functions,
non-templated constexpr functions shall be constexpr-suitable.

\begin{example}
\begin{codeblock}
Expand Down Expand Up @@ -830,16 +840,6 @@
\end{codeblock}
\end{example}

\pnum
If the instantiated template specialization of a constexpr function
template
or member function of a class template
would fail to satisfy the requirements for a constexpr
function,
that specialization is still a constexpr function,
even though a call to such a function cannot appear in a constant
expression.

\pnum
An invocation of a constexpr function in a given context
produces the same result as
Expand Down Expand Up @@ -885,7 +885,9 @@
In any \keyword{constexpr} variable declaration,
the full-expression of the initialization
shall be a constant expression\iref{expr.const}.
A \keyword{constexpr} variable shall have constant destruction.
A \keyword{constexpr} variable that is an object,
as well as any temporary to which a \keyword{constexpr} reference is bound,
shall have constant destruction.
\begin{example}
\begin{codeblock}
struct pixel {
Expand All @@ -909,10 +911,12 @@

\pnum
If a variable declared with the \keyword{constinit} specifier has
dynamic initialization\iref{basic.start.dynamic}, the program is ill-formed.
dynamic initialization\iref{basic.start.dynamic}, the program is ill-formed,
even if the implementation would perform that initialization as
a static initialization\iref{basic.start.static}.
\begin{note}
The \keyword{constinit} specifier ensures that the variable
is initialized during static initialization\iref{basic.start.static}.
is initialized during static initialization.
\end{note}

\pnum
Expand Down Expand Up @@ -1747,8 +1751,8 @@
\end{example}

\pnum
Return type deduction for a templated entity
that is a function or function template with a placeholder in its
Return type deduction for a templated
function with a placeholder in its
declared type occurs when the definition is instantiated even if the function
body contains a \tcode{return} statement with a non-type-dependent operand.
\begin{note}
Expand Down Expand Up @@ -6252,7 +6256,7 @@
A function explicitly defaulted on its first declaration
is implicitly inline\iref{dcl.inline},
and is implicitly constexpr\iref{dcl.constexpr}
if it satisfies the requirements for a constexpr function.
if it is constexpr-suitable.

\pnum
\begin{example}
Expand Down Expand Up @@ -6968,6 +6972,8 @@
not omit the \grammarterm{enum-base}.
The identifiers in an \grammarterm{enumerator-list} are declared as
constants, and can appear wherever constants are required.
The same identifier shall not appear as
the name of multiple enumerators in an \grammarterm{enumerator-list}.
\indextext{enumerator!value of}%
An \grammarterm{enumerator-definition} with \tcode{=} gives the associated
\grammarterm{enumerator} the value indicated by the
Expand Down Expand Up @@ -8251,7 +8257,7 @@
in determining the language linkage of
class members,
friend functions with a trailing \grammarterm{requires-clause}, and the
function type of class member functions.
function type of non-static class member functions.
\begin{example}
\begin{codeblock}
extern "C" typedef void FUNC_c();
Expand Down Expand Up @@ -8505,6 +8511,17 @@
the rules specifying to which entity or statement the attribute can apply or
the syntax rules for the attribute's \grammarterm{attribute-argument-clause}, if any.
\end{note}
\begin{note}
The \grammarterm{attribute}{s} specified in \ref{dcl.attr}
have optional semantics:
given a well-formed program,
removing all instances of any one of those \grammarterm{attribute}{s}
results in a program whose set of possible executions\iref{intro.abstract}
for a given input is
a subset of those of the original program for the same input,
absent implementation-defined guarantees
with respect to that \grammarterm{attribute}.
\end{note}
An \grammarterm{attribute-token} is reserved for future standardization if
\begin{itemize}
\item it is not an \grammarterm{attribute-scoped-token} and
Expand Down
Loading