Skip to content

Motions 2019 02 cwg 2 #2737

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 24 commits into from
Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2124f87
CWG581 Can a templated constructor be explicitly instantiated or spec…
Feb 22, 2019
c9cb45e
CWG1937 Incomplete specification of function pointer from lambda
Feb 22, 2019
942f88d
CWG1938 Should hosted/freestanding be implementation-defined?
Feb 22, 2019
764dcea
CWG2020 Inadequate description of odr-use of implicitly-invoked funct…
Feb 22, 2019
cbb21fb
[basic.def.odr] Apply additional edits from CWG review that were not
zygoloid Mar 9, 2019
573152d
CWG2051 Simplifying alias rules
Feb 22, 2019
f088588
CWG2083 Incorrect cases of odr-use
Feb 22, 2019
64c2c12
CWG2257 Lifetime extension of references vs exceptions
Feb 22, 2019
c3bf5f5
CWG2266 Has dependent type vs is type-dependent
Feb 22, 2019
5f7461d
[temp.dep.type] Rephrase to avoid suggesting that an expression can be
zygoloid Mar 9, 2019
595b8b0
CWG2289 Uniqueness of structured binding names
Feb 22, 2019
e6f307b
CWG2353 Potential results of a member access expression for a static …
Feb 22, 2019
e8ed1eb
CWG2354 Extended alignment and object representation
Feb 22, 2019
e81049e
CWG2365 Confusing specification for dynamic_cast
Feb 20, 2019
f6ff9bc
CWG2368 Differences in relational and three-way constant comparisons
Feb 20, 2019
7218980
CWG2372 Incorrect matching rules for block-scope extern declarations
Feb 20, 2019
d4f472e
CWG2379 Missing prohibition against constexpr in friend declaration
Feb 22, 2019
9788ef3
CWG2380 capture-default makes too many references odr-usable
Feb 22, 2019
93e0356
CWG2381 Composite pointer type of pointers to plain and noexcept memb…
Feb 23, 2019
73ccc57
CWG2384 Conversion function templates and qualification conversions
Feb 23, 2019
66ea6eb
CWG2385 Lookup for conversion-function-ids
Feb 23, 2019
498092c
CWG2386 tuple_size requirements for structured binding
Feb 23, 2019
a7a531a
CWG2387 Linkage of const-qualified variable template
Feb 23, 2019
8bc56e3
CWG2394 Const-default-constructible for members
Feb 20, 2019
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
122 changes: 82 additions & 40 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@

\pnum
\indextext{expression!potentially evaluated}%
An expression is \defn{potentially evaluated} unless it is an
unevaluated operand\iref{expr.prop} or a subexpression thereof.
An expression or conversion is \defn{potentially evaluated} unless it is
an unevaluated operand\iref{expr.prop},
a subexpression thereof, or
a conversion in an initialization or conversion sequence in such a context.
The set of \defn{potential results} of an expression \tcode{e} is
defined as follows:
\begin{itemize}
Expand All @@ -290,12 +292,17 @@
\item If \tcode{e} is a subscripting operation\iref{expr.sub} with
an array operand, the set contains the potential results of that operand.
\item If \tcode{e} is a class member access
expression\iref{expr.ref}, the set contains the potential results of
the object expression.
expression\iref{expr.ref} of the form
\tcode{e1 . \opt{template} e2}
naming a non-static data member,
the set contains the potential results of \tcode{e1}.
\item if \tcode{e} is a class member access expression
naming a static data member,
the set contains the \grammarterm{id-expression} designating the data member.
\item If \tcode{e} is a pointer-to-member
expression\iref{expr.mptr.oper} whose second operand is a constant
expression, the set contains the potential results of the object
expression.
expression\iref{expr.mptr.oper} of the form
\tcode{e1 .* e2},
the set contains the potential results of \tcode{e1}.
\item If \tcode{e} has the form \tcode{(e1)}, the set contains the
potential results of \tcode{e1}.
\item If \tcode{e} is a glvalue conditional
Expand All @@ -322,48 +329,62 @@
\end{note}

\pnum
\indextext{function!named by an expression}%
A function is \defn{named by an expression} as follows:
A function is \defnx{named by}{function!named by expression or conversion}
an expression or conversion as follows:
\begin{itemize}
\item
A function whose name appears in an expression
is named by that expression
if it is the unique lookup result or the selected member
of a set of overloaded functions~(\ref{basic.lookup}, \ref{over.match}, \ref{over.over}),
A function is named by an expression or conversion
if it is the unique result of a name lookup or the selected member
of a set of overloaded functions~(\ref{basic.lookup}, \ref{over.match}, \ref{over.over})
in an overload resolution performed
as part of forming that expression or conversion,
unless it is a pure virtual function and either
its name is not explicitly qualified or
the expression is not an \grammarterm{id-expression} naming the function with
an explicitly qualified name or
the expression forms a pointer to member\iref{expr.unary.op}.
\begin{note} This covers
taking the address of functions~(\ref{conv.func}, \ref{expr.unary.op}),
calls to named functions\iref{expr.call},
operator overloading\iref{over},
user-defined conversions\iref{class.conv.fct},
allocation functions for placement \grammarterm{new-expression}{s}\iref{expr.new}, as well as
allocation functions for \grammarterm{new-expression}{s}\iref{expr.new}, as well as
non-default initialization\iref{dcl.init}.
A constructor selected to copy or move an object of class type
is considered to be named by an expression
is considered to be named by an expression or conversion
even if the call is actually elided by the implementation\iref{class.copy.elision}. \end{note}
\item
An allocation or deallocation function for a class
A deallocation function for a class
is named by a \grammarterm{new-expression}
as specified in~\ref{expr.new} and~\ref{class.free}.
if it is the single matching deallocation function
for the allocation function selected by overload resolution,
as specified in~\ref{expr.new}.
\item
A deallocation function for a class
is named by a delete expression
is named by a \grammarterm{delete-expression}
if it is the selected usual deallocation function
as specified in~\ref{expr.delete} and~\ref{class.free}.
\end{itemize}

\pnum
A variable \tcode{x} whose name appears as a
potentially-evaluated expression \tcode{ex} is \defnx{odr-used}{odr-use} by \tcode{ex} unless
applying the lvalue-to-rvalue conversion\iref{conv.lval} to \tcode{x} yields
a constant expression\iref{expr.const}
that does not invoke a function
other than a trivial special member function\iref{special}
and, if \tcode{x} is an object, \tcode{ex} is an element of
the set of potential results of an expression \tcode{e}, where either the lvalue-to-rvalue
conversion\iref{conv.lval} is applied to \tcode{e}, or \tcode{e} is
a discarded-value expression\iref{expr.prop}.
potentially-evaluated expression \tcode{e}
is \defnx{odr-used}{odr-use} by \tcode{e} unless
\begin{itemize}
\item
\tcode{x} is a reference that is
usable in constant expressions\iref{expr.const}, or
\item
\tcode{x} is a variable of non-reference type that is
usable in constant expressions and has no mutable subobjects, and
\tcode{e} is an element of the set of potential results of an expression
of non-volatile-qualified non-class type
to which the lvalue-to-rvalue conversion\iref{conv.lval} is applied, or
\item
\tcode{x} is a variable of non-reference type, and
\tcode{e} is an element of the set of potential results
of a discarded-value expression\iref{expr.prop}
to which the lvalue-to-rvalue conversion is not applied.
\end{itemize}

\pnum
A structured binding is odr-used if it appears as a potentially-evaluated expression.
Expand All @@ -376,7 +397,8 @@
\pnum
A virtual member
function is odr-used if it is not pure.
A function is odr-used if it is named by a potentially-evaluated expression.
A function is odr-used if it is named by
a potentially-evaluated expression or conversion.
A non-placement allocation or deallocation
function for a class is odr-used by the definition of a constructor of that
class. A non-placement deallocation function for a class is odr-used by the
Expand Down Expand Up @@ -415,7 +437,10 @@
\begin{itemize}
\item the intervening declarative region is a block scope, or
\item the intervening declarative region is the function parameter scope of a \grammarterm{lambda-expression}
that has a \grammarterm{simple-capture} naming the entity or has a \grammarterm{capture-default}.
that has a \grammarterm{simple-capture}
naming the entity or has a \grammarterm{capture-default}, and
the block scope of the \grammarterm{lambda-expression}
is also an intervening declarative region.
\end{itemize}
\end{itemize}

Expand All @@ -425,11 +450,13 @@
\begin{example}
\begin{codeblock}
void f(int n) {
[] { n = 1; }; // error, \tcode{n} is not odr-usable due to intervening lambda-expression
[] { n = 1; }; // error: \tcode{n} is not odr-usable due to intervening lambda-expression
struct A {
void f() { n = 2; } // error, \tcode{n} is not odr-usable due to intervening function definition scope
void f() { n = 2; } // error: \tcode{n} is not odr-usable due to intervening function definition scope
};
void g(int = n); // error, \tcode{n} is not odr-usable due to intervening function parameter scope
void g(int = n); // error: \tcode{n} is not odr-usable due to intervening function parameter scope
[=](int k = n) {}; // error: \tcode{n} is not odr-usable due to being
// outside the block scope of the \grammarterm{lambda-expression}
[&] { [n]{ return n; }; }; // OK
}
\end{codeblock}
Expand Down Expand Up @@ -696,9 +723,13 @@
all refer to the same variable, non-static data member, or enumerator,
or all refer to functions and function templates;
in this case the class name or enumeration name is
hidden\iref{basic.scope.hiding}. \begin{note} A namespace name or a
class template name must be unique in its declarative
region~(\ref{namespace.alias}, \ref{temp}). \end{note}
hidden\iref{basic.scope.hiding}.
\begin{note}
A structured binding\iref{dcl.struct.bind},
namespace name\iref{basic.namespace}, or
class template name\iref{temp}
must be unique in its declarative region.
\end{note}
\end{itemize}
\begin{note} These restrictions apply to the declarative region into which
a name is introduced, which is not necessarily the same as the region in
Expand Down Expand Up @@ -2373,15 +2404,20 @@
linkage if it is the name of
\begin{itemize}
\item
a variable, function or function template that is
a variable, variable template, function, or function template that is
explicitly declared \tcode{static}; or,
\item
a non-inline variable of non-volatile const-qualified type that is
a non-inline non-template variable of non-volatile const-qualified type
that is
neither explicitly declared \tcode{extern} nor previously
declared to have external linkage; or
\item
a data member of an anonymous union.
\end{itemize}
\begin{note}
An instantiated variable template that has const-qualified type
can have external linkage, even if not declared \tcode{extern}.
\end{note}

\pnum
An unnamed namespace or a namespace declared directly or indirectly within an
Expand Down Expand Up @@ -2414,8 +2450,12 @@
\pnum
The name of a function declared in block scope and the name of a variable declared by a
block scope \tcode{extern} declaration have linkage. If there is a visible declaration
of an entity with linkage having the same name and type, ignoring entities declared
outside the innermost enclosing namespace scope, the block scope declaration declares
of an entity with linkage, ignoring entities declared
outside the innermost enclosing namespace scope,
such that the block scope declaration would be
a (possibly ill-formed) redeclaration
if the two declarations appeared in the same declarative region,
the block scope declaration declares
that same entity and receives the linkage of the previous declaration. If there is more
than one such matching entity, the program is ill-formed. Otherwise, if no matching
entity is found, the block scope entity receives external linkage.
Expand All @@ -2424,9 +2464,11 @@
\begin{example}
\begin{codeblock}
static void f();
extern "C" void h();
static int i = 0; // \#1
void g() {
extern void f(); // internal linkage
extern void h(); // C language linkage
int i; // \#2: \tcode{i} has no linkage
{
extern void f(); // internal linkage
Expand Down
3 changes: 2 additions & 1 deletion source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,8 @@
of reference type,

\item any non-variant non-static data member of const-qualified type (or array
thereof) with no \grammarterm{brace-or-equal-initializer} does not have a user-provided default constructor,
thereof) with no \grammarterm{brace-or-equal-initializer}
is not const-default-constructible\iref{dcl.init}.

\item \tcode{X} is a union and all of its variant members are of const-qualified
type (or array thereof),
Expand Down
7 changes: 2 additions & 5 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6153,7 +6153,7 @@
\pnum
Otherwise, if
the \grammarterm{qualified-id} \tcode{std::tuple_size<E>}
names a complete type,
names a complete class type with a member named \tcode{value},
the expression \tcode{std::tuple_size<E>::value}
shall be a well-formed integral constant expression
and
Expand Down Expand Up @@ -8071,10 +8071,7 @@
An \grammarterm{alignment-specifier} may also be applied to the declaration
of a class (in an
\grammarterm{elaborated-type-specifier}\iref{dcl.type.elab} or
\grammarterm{class-head}\iref{class}, respectively) and to the
declaration of an enumeration (in an
\grammarterm{opaque-enum-declaration} or \grammarterm{enum-head},
respectively\iref{dcl.enum}).
\grammarterm{class-head}\iref{class}, respectively).
An \grammarterm{alignment-specifier} with an ellipsis is a pack expansion\iref{temp.variadic}.

\pnum
Expand Down
6 changes: 6 additions & 0 deletions source/exceptions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@
and whose destructor has not yet begun execution,
except that in the case of destruction, the variant members of a
union-like class are not destroyed.
\begin{note}
If such an object has a reference member
that extends the lifetime of a temporary object,
this ends the lifetime of the reference member,
so the lifetime of the temporary object is effectively not extended.
\end{note}
The subobjects are destroyed in the reverse order of the completion of
their construction. Such destruction is sequenced before entering a
handler of the \grammarterm{function-try-block} of the constructor or destructor,
Expand Down
Loading