Skip to content

[Motions 2022 11 cwg 1] P2709R0 ready issues except 2635 and 2602 #5984

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 32 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cdf92eb
CWG2392 new-expression size check and constant evaluation
burblebee Nov 15, 2022
7d802b4
CWG2407 Missing entry in Annex C for defaulted comparison operators
burblebee Nov 15, 2022
99c8605
CWG2410 Implicit calls of immediate functions
burblebee Nov 15, 2022
a111f0f
CWG2428 Deprecating a concept
burblebee Nov 15, 2022
45aadc0
CWG2440 Allocation in core constant expressions
burblebee Nov 15, 2022
bcd6e66
CWG2451 promise.unhandled_exception() and final suspend point
burblebee Nov 15, 2022
eb43529
CWG2508 Restrictions on uses of template parameter names
burblebee Nov 15, 2022
e04d375
CWG2583 Common initial sequence should consider over-alignment
burblebee Nov 15, 2022
41506fb
CWG2590 Underlying type should determine size and alignment requireme…
burblebee Nov 15, 2022
869679a
CWG2598 Unions should not require a non-static data member of literal…
burblebee Nov 15, 2022
b52fdb0
CWG2599 What does initializing a parameter include?
burblebee Nov 15, 2022
f0f778a
CWG2601 Tracking of created and destroyed subobjects
burblebee Nov 15, 2022
c8c7011
CWG2603 Holistic functional equivalence for function templates
burblebee Nov 15, 2022
96aca58
CWG2604 Attributes for an explicit specialization
burblebee Nov 15, 2022
afc88d5
CWG2605 Implicit-lifetime aggregates
burblebee Nov 15, 2022
319d7da
CWG2610 Indirect private base classes in aggregates
burblebee Nov 15, 2022
6e8c9bc
CWG2611 Missing parentheses in expansion of fold-expression could cau…
burblebee Nov 15, 2022
ea7df94
CWG2612 Incorrect comment in example
burblebee Nov 15, 2022
d9dc415
CWG2613 Incomplete definition of resumer
burblebee Nov 15, 2022
2fe137e
CWG2614 Unspecified results for class member access
burblebee Nov 15, 2022
092dec0
CWG2616 Imprecise restrictions on break and continue
burblebee Nov 15, 2022
bb4acc8
CWG2618 Substitution during deduction should exclude exception specif…
burblebee Nov 15, 2022
07b5caa
CWG2619 Kind of initialization for a designated-initializer-list
burblebee Nov 15, 2022
394a016
CWG2620 Nonsensical disambiguation rule
burblebee Nov 15, 2022
2c1f16d
CWG2622 Compounding types from function and pointer-to-member types
burblebee Nov 15, 2022
fb69b32
CWG2624 Array delete expression with no array cookie
burblebee Nov 15, 2022
3f9de47
CWG2625 Deletion of pointer to out-of-lifetime object
burblebee Nov 15, 2022
68653fc
CWG2626 Rephrase ones' complement using base-2 representation
burblebee Nov 15, 2022
acd2c81
CWG2627 Bit-fields and narrowing conversions
burblebee Nov 15, 2022
f8600b8
CWG2629 Variables of floating-point type as switch conditions
burblebee Nov 15, 2022
3f33361
CWG2630 Syntactic specification of class completeness
burblebee Nov 15, 2022
568c342
CWG2641 Redundant specification of value category of literals
burblebee Nov 15, 2022
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
43 changes: 26 additions & 17 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@
\item
their object parameters have the same type.
\end{itemize}
\indextext{template!function!corresponding object parameter}%
Two non-static member function templates have
\defnadjx{corresponding}{object parameters}{object parameter} if:
\begin{itemize}
Expand All @@ -894,6 +895,14 @@
\item
the types of their object parameters are equivalent.
\end{itemize}
\indextext{template!function!corresponding signature}%
Two function templates have
\defnadjx{corresponding}{signatures}{signature} if
their \grammarterm{template-parameter-list}{s}
have the same length,
their corresponding \grammarterm{template-parameter}{s} are equivalent,
they have equivalent non-object-parameter-type-lists and return types (if any), and,
if both are non-static members, they have corresponding object parameters.

\pnum
Two declarations \defn{correspond}
Expand Down Expand Up @@ -925,13 +934,9 @@
if both are non-static members,
they have corresponding object parameters, or
\item
both declare function templates with equivalent
non-object-parameter-type-lists,
return types (if any),
\grammarterm{template-head}s, and
trailing \grammarterm{requires-clause}s (if any), and,
if both are non-static members,
they have corresponding object parameters.
both declare function templates with corresponding signatures and equivalent
\grammarterm{template-head}s and
trailing \grammarterm{requires-clause}s (if any).
\end{itemize}
\end{itemize}
\begin{note}
Expand Down Expand Up @@ -3426,8 +3431,7 @@
program has undefined behavior if:
\begin{itemize}
\item
the object will be or was of a class type with a non-trivial destructor
and the pointer is used as the operand of a \grammarterm{delete-expression},
the pointer is used as the operand of a \grammarterm{delete-expression},
\item
the pointer is used to access a non-static data member or call a
non-static member function of the object, or
Expand Down Expand Up @@ -4742,15 +4746,20 @@
has all of the following properties:
\begin{itemize}
\item it has a constexpr destructor\iref{dcl.constexpr},
\item it is either a closure type\iref{expr.prim.lambda.closure},
an aggregate type\iref{dcl.init.aggr}, or
has at least one constexpr constructor or constructor template
\item all of its non-static non-variant data members and base classes are of non-volatile literal types, and
\item it
\begin{itemize}
\item is a closure type\iref{expr.prim.lambda.closure},
\item is an aggregate union type that has either
no variant members or
at least one variant member of non-volatile literal type,
\item is a non-union aggregate type for which
each of its anonymous union members
satisfies the above requirements for an aggregate union type, or
\item has at least one constexpr constructor or constructor template
(possibly inherited\iref{namespace.udecl} from a base class)
that is not a copy or move constructor,
\item if it is a union, at least one of its non-static data members is
of non-volatile literal type, and
\item if it is not a union, all of its non-static data members and base classes are
of non-volatile literal types.
that is not a copy or move constructor.
\end{itemize}
\end{itemize}
\end{itemize}
\begin{note}
Expand Down
23 changes: 15 additions & 8 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
A class \tcode{S} is an \defnadj{implicit-lifetime}{class} if
\begin{itemize}
\item
it is an aggregate or
it is an aggregate whose destructor is not user-provided or
\item
it has at least one trivial eligible constructor and
a trivial, non-deleted destructor.
Expand Down Expand Up @@ -605,10 +605,9 @@
\end{note}

\pnum
A class is considered a completely-defined object
type\iref{term.incomplete.type} (or complete type) at the closing \tcode{\}} of
the \grammarterm{class-specifier}.
The class is regarded as complete within its complete-class contexts;
A class is regarded as complete
where its definition is reachable and
within its complete-class contexts;
otherwise it is regarded as incomplete within its own class
\grammarterm{member-specification}.

Expand Down Expand Up @@ -785,13 +784,21 @@
The \defn{common initial sequence} of two standard-layout struct\iref{class.prop}
types is the longest sequence of non-static data
members and bit-fields in declaration order, starting with the first
such entity in each of the structs, such that corresponding entities
such entity in each of the structs, such that
\begin{itemize}
\item
corresponding entities
have layout-compatible types\iref{basic.types},
\item
corresponding entities have the same alignment requirements\iref{basic.align},
\item
either both entities are declared with
the \tcode{no_unique_address} attribute\iref{dcl.attr.nouniqueaddr}
or neither is,
and either both entities are bit-fields with the same width
or neither is, and
\item
either both entities are bit-fields with the same width
or neither is a bit-field.
\end{itemize}
\begin{example}
\begin{codeblock}
struct A { int a; char b; };
Expand Down
25 changes: 25 additions & 0 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,31 @@
}
\end{codeblock}

\diffref{over.match.oper}
\change
Overload resolution may change for equality operators\iref{expr.eq}.
\rationale
Support calling \tcode{operator==} with reversed order of arguments.
\effect
Valid \CppXVII{} code that uses equality operators with conversion functions
may be ill-formed or have different semantics in this revision of \Cpp{}.
For example:
\begin{codeblock}
struct A {
operator int() const { return 10; }
};

bool operator==(A, int); // \#1
// \#2 is built-in candidate: \tcode{bool operator==(int, int);}
bool b = 10 == A(); // calls \#1 with reversed order of arguments; previously selected \#2

struct B {
bool operator==(const B&); // member function with no cv-qualifier
};
B b1;
bool eq = (b1 == b1); // ambiguous; previously well-formed
\end{codeblock}

\rSec2[diff.cpp17.temp]{\ref{temp}: templates}

\diffref{temp.names}
Expand Down
88 changes: 70 additions & 18 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2323,12 +2323,16 @@
\pnum
The ambiguity arising from the similarity between a function-style cast and
a declaration mentioned in~\ref{stmt.ambig} can also occur in the context of a declaration.
In that context, the choice is between a function declaration with
a redundant set of parentheses around a parameter name and an object declaration
with a function-style cast as the initializer.
In that context, the choice is between
an object declaration
with a function-style cast as the initializer and
a declaration involving a function declarator
with a redundant set of parentheses around a parameter name.
Just as for the ambiguities mentioned in~\ref{stmt.ambig},
the resolution is to consider any construct that could possibly
be a declaration a declaration.
the resolution is to consider any construct,
such as the potential parameter declaration,
that could possibly be a declaration
to be a declaration.
\begin{note}
A declaration can be explicitly disambiguated by adding parentheses
around the argument.
Expand Down Expand Up @@ -4455,7 +4459,8 @@
as well as in argument passing, function return,
throwing an exception\iref{except.throw},
handling an exception\iref{except.handle},
and aggregate member initialization\iref{dcl.init.aggr},
and aggregate member initialization other than by a
\grammarterm{designated-initializer-clause}\iref{dcl.init.aggr},
is called
\defn{copy-initialization}.
\begin{note}
Expand Down Expand Up @@ -4548,7 +4553,7 @@
is the same class as the class of the destination,
the initializer expression is used to initialize the destination object.
\begin{example}
\tcode{T x = T(T(T()));} calls the \tcode{T} default constructor to initialize \tcode{x}.
\tcode{T x = T(T(T()));} value-initializes \tcode{x}.
\end{example}
\item
Otherwise, if the initialization is direct-initialization,
Expand Down Expand Up @@ -4680,6 +4685,14 @@
An \grammarterm{initializer-clause} followed by an ellipsis is a
pack expansion\iref{temp.variadic}.

\pnum
Initialization includes
the evaluation of all subexpressions of
each \grammarterm{initializer-clause} of
the initializer (possibly nested within \grammarterm{braced-init-list}{s}) and
the creation of any temporary objects for
function arguments or return values\iref{class.temporary}.

\pnum
If the initializer is a parenthesized \grammarterm{expression-list},
the expressions are evaluated in the order
Expand Down Expand Up @@ -4736,9 +4749,9 @@
\item
no private or protected direct non-static data members\iref{class.access},
\item
no virtual functions\iref{class.virtual}, and
no private or protected direct base classes\iref{class.access.base}, and
\item
no virtual, private, or protected base classes\iref{class.mi}.
no virtual functions\iref{class.virtual} or virtual base classes\iref{class.mi}.
\end{itemize}
\begin{note}
Aggregate initialization does not allow accessing
Expand Down Expand Up @@ -4790,7 +4803,7 @@
the initializer list is
a brace-enclosed \grammarterm{designated-initializer-list},
the element is initialized by the
\grammarterm{designated-initializer-list} \tcode{\{ }\placeholder{D}\tcode{ \}},
\grammarterm{braced-init-list} \tcode{\{ }\placeholder{D}\tcode{ \}},
where \placeholder{D} is the \grammarterm{designated-initializer-clause}
naming a member of the anonymous union member.
There shall be only one such \grammarterm{designated-initializer-clause}.
Expand Down Expand Up @@ -4818,6 +4831,11 @@
a narrowing conversion\iref{dcl.init.list} is required
to convert the expression, the program is ill-formed.
\begin{note}
If the initialization is by \grammarterm{designated-initializer-clause},
its form determines whether copy-initialization or direct-initialization
is performed.
\end{note}
\begin{note}
If an initializer is itself an initializer list,
the element is list-initialized, which will result in a recursive application
of the rules in this subclause if the element is an aggregate.
Expand Down Expand Up @@ -5975,8 +5993,18 @@
original type, or

\item from an integer type or unscoped enumeration type to an integer type that cannot
represent all the values of the original type, except where the source is a constant
represent all the values of the original type, except where
\begin{itemize}
\item
the source is a bit-field whose width $w$ is less than that of its type
(or, for an enumeration type, its underlying type) and
the target type can represent all the values
of a hypothetical extended integer type
with width $w$ and with the same signedness as the original type or
\item
the source is a constant
expression whose value after integral promotions will fit into the target type, or
\end{itemize}

\item from a pointer type or a pointer-to-member type to \tcode{bool}.
\end{itemize}
Expand Down Expand Up @@ -6448,19 +6476,20 @@
where
\begin{itemize}
\item
\indextext{coroutine!await expression}%
the \grammarterm{await-expression} containing
the call to \tcode{initial_suspend}
is the \defn{initial suspend point}, and
is the \defnadj{initial}{await expression}, and
\item
the \grammarterm{await-expression} containing
the call to \tcode{final_suspend}
is the \defn{final suspend point}, and
is the \defnadj{final}{await expression}, and
\item
\placeholder{initial-await-resume-called}
is initially \tcode{false} and is set to \tcode{true}
immediately before the evaluation
of the \placeholder{await-resume} expression\iref{expr.await}
of the initial suspend point, and
of the initial await expression, and
\item
\placeholder{promise-type} denotes the promise type, and
\item
Expand All @@ -6476,7 +6505,19 @@
constructor is found\iref{over.match.viable}, then
\placeholder{promise-constructor-arguments} is
\tcode{($\tcode{q}_1$, $\dotsc$, $\tcode{q}_n$)}, otherwise
\placeholder{promise-constructor-arguments} is empty.
\placeholder{promise-constructor-arguments} is empty, and
\item
a coroutine is suspended at the \defnadj{initial}{suspend point} if
it is suspended at the initial await expression, and
\item
a coroutine is suspended at a \defnadj{final}{suspend point} if
it is suspended
\begin{itemize}
\item
at a final await expression or
\item
due to an exception exiting from \tcode{unhandled_exception()}.
\end{itemize}
\end{itemize}

\pnum
Expand Down Expand Up @@ -6504,7 +6545,7 @@
a resumption member function\iref{coroutine.handle.resumption}
of a coroutine handle\iref{coroutine.handle}
that refers to the coroutine.
The function that invoked a resumption member function is
The evaluation that invoked a resumption member function is
called the \defnx{resumer}{coroutine!resumer}.
Invoking a resumption member function for a coroutine
that is not suspended results in undefined behavior.
Expand Down Expand Up @@ -6642,7 +6683,8 @@
\pnum
If the evaluation of the expression
\tcode{\exposid{promise}.unhandled_exception()} exits via an exception,
the coroutine is considered suspended at the final suspend point.
the coroutine is considered suspended at the final suspend point
and the exception propagates to the caller or resumer.

\pnum
The expression \keyword{co_await} \tcode{\exposid{promise}.final_suspend()}
Expand Down Expand Up @@ -7027,6 +7069,15 @@
this range.
\end{footnote}

\pnum
An enumeration has
the same size,
value representation, and
alignment requirements\iref{basic.align}
as its underlying type.
Furthermore, each value of an enumeration has the same representation
as the corresponding value of the underlying type.

\pnum
Two enumeration types are \defnx{layout-compatible enumerations}{layout-compatible!enumeration}
if they have the same underlying type.
Expand Down Expand Up @@ -8691,7 +8742,8 @@
a function,
a namespace,
an enumeration,
an enumerator, or
an enumerator,
a concept, or
a template specialization.

\pnum
Expand Down
Loading