Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6217da8
CWG3025 Deallocation functions returning void
burblebee Nov 22, 2026
5a0c102
CWG3121 Zero-size arrays in function parameters
burblebee Nov 22, 2026
3eea211
CWG3137 Composite pointer type with qualification and pointer-to-memb…
burblebee Nov 22, 2026
ef526df
CWG3144 Granularity of implementation choice for sizeof and subobject…
burblebee Nov 22, 2026
c603028
CWG3160 Grammar ambiguity with class member declarations
burblebee Nov 22, 2026
49d9f57
CWG3163 Grammar ambiguity for nodeclspec-function-declaration
burblebee Nov 22, 2026
963caf4
CWG3192 Out-of-line definition of an enum member of a local class
burblebee Nov 22, 2026
510ad17
CWG3194 Lexing of <=>
burblebee Nov 22, 2026
b20979e
CWG3197 Relaxed requirements for integer representations
burblebee Nov 22, 2026
ce55ef0
CWG3199 Missing predefined macros for char16_t and char32_t
burblebee Nov 22, 2026
dc793d9
CWG3200 Qualified pointer pointing to unqualified object
burblebee Nov 22, 2026
bed57f0
CWG3201 Zero- and default-initialization of cv-qualified std::meta::info
burblebee Nov 22, 2026
e96f27e
CWG3204 Restrictions on arguments for ellipsis parameter
burblebee Nov 23, 2026
bbd416d
CWG3206 Scattered definition of "local class"
burblebee Nov 23, 2026
6eda683
CWG3208 Base classes of virtual base classes
burblebee Nov 23, 2026
ae72121
CWG3210 constexpr for empty destructuring expansion statements
burblebee Nov 23, 2026
c0b037c
CWG3211 Explicitly captured variable is not odr-usable in lambda cont…
burblebee Nov 23, 2026
0f091ab
CWG3213 Restrictions on the template-head of a concept definition
burblebee Nov 23, 2026
a85c1ba
CWG3214 Redeclaration of types and namespaces and their aliases
burblebee Nov 23, 2026
f7c151c
CWG3215 this in a default member initializer during constant evaluation
burblebee Nov 23, 2026
ae6a160
CWG3218 Expanding packs created within a pack expansion
burblebee Nov 23, 2026
4982016
CWG3221 Missing Annex C entry for conflicting declarations in for-loops
burblebee Nov 23, 2026
dd059c2
CWG3222 Deleted module directives
burblebee Nov 23, 2026
623941b
CWG3223 Undefined behavior for constructor preconditions and destruct…
burblebee Nov 23, 2026
eef04aa
CWG3224 Directives in multi-line macro arguments
burblebee Nov 23, 2026
4f8e589
CWG3225 Conversion of bool to signed integer of width 1
burblebee Nov 23, 2026
3079eee
CWG3226 Conflict of templated entity vs. enclosing template
burblebee Nov 23, 2026
e8176d4
CWG3227 IFNDR for always-empty packs
burblebee Nov 23, 2026
643573e
CWG3228 Empty initializers vs. empty packs
burblebee Nov 23, 2026
4b3d117
CWG3229 Incomplete restrictions on same meaning for same tokens
burblebee Nov 23, 2026
6aca01b
CWG3230 Are non-static data members "variables"?
burblebee Nov 23, 2026
d7edb59
CWG3234 explicit and eligible constructors
burblebee Nov 23, 2026
f859ecf
CWG3235 begin-expr and end-expr should refer to range
burblebee Nov 23, 2026
8bd2723
CWG3237 Missing restrictions imposed by __STDC_MB_MIGHT_NEQ_WC__
burblebee Nov 23, 2026
3c21e85
CWG3238 Postcondition result bindings as declarations
burblebee Nov 23, 2026
0b4f02a
CWG3240 Return object destruction from throwing postcondition evaluation
burblebee Nov 23, 2026
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
76 changes: 55 additions & 21 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
\grammarterm{identifier}
in a structured binding declaration\iref{dcl.struct.bind},
\item
\grammarterm{identifier}
in a \grammarterm{result-name-introducer}
\grammarterm{result-name-introducer}
in a postcondition assertion\iref{dcl.contract.res},
\item
\grammarterm{init-capture}\iref{expr.prim.lambda.capture},
Expand Down Expand Up @@ -126,16 +125,17 @@
\end{note}

\pnum
A \defn{variable} is introduced by the
declaration $D$ of
A \defn{variable} is introduced by an object declaration\iref{dcl.pre} that
\begin{itemize}
\item
a reference other than a non-static data member or
is not the \grammarterm{parameter-declaration} of
a \grammarterm{template-parameter} and
\item
an object,
does not declare a non-static member\iref{class.mem.general}.
\end{itemize}
where $D$ is not the \grammarterm{parameter-declaration} of
a \grammarterm{template-parameter}.
\begin{note}
An object declaration can declare an object or a reference.
\end{note}

\pnum
An \defn{entity} is a
Expand Down Expand Up @@ -623,8 +623,16 @@
a \grammarterm{lambda-expression}
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 scope.
at least one of the following is also an intervening scope:
\begin{itemize}
\item
the block scope of the \grammarterm{lambda-expression}, or
\item
a contract-assertion scope\iref{basic.scope.contract}
introduced by a function contract assertion\iref{dcl.contract.func} of
the function call operator or operator template
of the corresponding closure type.
\end{itemize}
\end{itemize}
\end{itemize}

Expand Down Expand Up @@ -826,10 +834,13 @@
that are not value-dependent
shall have the same value\iref{expr.const,temp.dep.constexpr}.

\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
function.
%%FIXME: Hard to parse, should all be preceded by "the"? Or none?
\item In each such definition,
the operators referred to,
the implicit calls to conversion functions,
constructors, and
allocation and deallocation functions
shall refer to the same function, if any.

\item In each such definition,
a default argument used by an (implicit or explicit) function call or
Expand Down Expand Up @@ -3067,10 +3078,21 @@
Two declarations of entities declare the same entity
if, considering declarations of unnamed types to introduce their names
for linkage purposes, if any\iref{dcl.typedef,dcl.enum},
\begin{itemize}
\item
they correspond\iref{basic.scope.scope},
have the same target scope that is not a function or template parameter scope,
\item
both have the same target scope that
is not a function or template parameter scope,
\item
neither is a name-independent declaration,
and either
\item
if either declares a type alias, both do,
\item
if either declares a namespace alias, both do, and

\item
one of the following holds:
\begin{itemize}
\item
they appear in the same translation unit, or
Expand All @@ -3079,6 +3101,7 @@
\item
they both declare names with module or external linkage and are attached to the same module.
\end{itemize}
\end{itemize}
\begin{note}
There are other circumstances in which declarations declare
the same entity\iref{dcl.link,temp.type,temp.spec.partial}.
Expand Down Expand Up @@ -4030,6 +4053,7 @@
well-defined. Indirection through such a pointer is permitted but the resulting lvalue may only be used in
limited ways, as described below. The
program has undefined behavior if:
%%FIXME: The 1st item should end with "or".
\begin{itemize}
\item
the pointer is used as the operand of a \grammarterm{delete-expression}\ubdef{lifetime.outside.pointer.delete},
Expand All @@ -4038,8 +4062,7 @@
non-static member function of the object\ubdef{lifetime.outside.pointer.member}, or
\item
the pointer is converted\iref{conv.ptr,expr.static.cast} to a pointer
to a virtual base class\ubdef{lifetime.outside.pointer.virtual} or
to a base class thereof, or
to a transitively virtual base class\iref{class.mi}\ubdef{lifetime.outside.pointer.virtual}, or
\item
the pointer is used as the operand of a
\keyword{dynamic_cast}\iref{expr.dynamic.cast}\ubdef{lifetime.outside.pointer.dynamic.cast}.
Expand Down Expand Up @@ -4089,7 +4112,8 @@
\begin{itemize}
\item the glvalue is used to access the object\ubdef{lifetime.outside.glvalue.access}, or
\item the glvalue is used to call a non-static member function of the object\ubdef{lifetime.outside.glvalue.member}, or
\item the glvalue is bound to a reference to a virtual base class\iref{dcl.init.ref}\ubdef{lifetime.outside.glvalue.virtual}, or
\item the glvalue is bound to a reference to
a transitively virtual base class\iref{dcl.init.ref,class.mi}\ubdef{lifetime.outside.glvalue.virtual}, or
\item the glvalue is used as the operand of a
\keyword{dynamic_cast}\iref{expr.dynamic.cast} or as the operand of
\keyword{typeid}\ubdef{lifetime.outside.glvalue.dynamic.cast}.
Expand Down Expand Up @@ -4673,7 +4697,7 @@

\pnum
\indextext{\idxcode{delete}!overloading and}%
Each deallocation function shall return \keyword{void}.
A deallocation function shall have a declared return type \keyword{void}.
A deallocation function shall not have
a potentially throwing exception specification\iref{except.spec}.
If the function is a destroying operator delete
Expand Down Expand Up @@ -5175,7 +5199,7 @@
sequence of \placeholder{N} \tcode{\keyword{unsigned} \keyword{char}} objects taken up
by a non-bit-field complete object of type \tcode{T},
where \placeholder{N} equals
\tcode{\keyword{sizeof}(T)}.
\tcode{\keyword{sizeof}(T)}\iref{expr.sizeof}.
The \defnx{value representation}{representation!value}
of a type \tcode{T} is the set of bits
in the object representation of \tcode{T}
Expand All @@ -5199,6 +5223,12 @@
with that of the C programming language.
\end{footnote}

\pnum
For any complete object type,
its size and the presence and placement of padding
does not vary within a program
(including during constant evaluation\iref{expr.const}).

\pnum
\indextext{type!incompletely-defined object}%
A class that has been declared but not defined, an enumeration type in certain
Expand Down Expand Up @@ -5632,6 +5662,10 @@
however, unscoped enumerations can be promoted to integral types
as specified in \ref{conv.prom}.
\end{note}
If the bits in the value representation of an object of integer type
all have value zero,
the object contains the value \tcode{false}
if it is of type \keyword{bool} and zero otherwise.

\pnum
\indextext{floating-point type|see{type, floating-point}}%
Expand Down
125 changes: 93 additions & 32 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,32 @@
\begin{itemize}
\item the function is not deleted,
\item the associated constraints\iref{temp.constr}, if any, are satisfied, and
\item no special member function of the same kind
whose associated constraints, if any, are satisfied
is more constrained\iref{temp.constr.order}.
\item there exists no special member function
\begin{itemize}
\item that is of the same kind,
\item that is not more explicit,
\item whose associated constraints, if any, are satisfied, and
\item that is more constrained\iref{temp.constr.order},
\end{itemize}
where a function \tcode{F1} is more explicit than a function \tcode{F2}
if \tcode{F1} is explicit\iref{dcl.fct.spec} and \tcode{F2} is not.
\end{itemize}
\begin{example}
\begin{codeblock}
template<class T>
struct X {
X() = default;
X(const X&) = default; // \#1
private:
explicit X(const X&) requires true = default; // \#2
};

int main() {
X<int> x;
X<int> x2 = x; // OK, selects \#1; both \#1 and \#2 are eligible
}
\end{codeblock}
\end{example}

\pnum
For a class, its direct non-static data members, its non-virtual direct base classes,
Expand All @@ -1161,32 +1183,33 @@
\indextext{special member function|see{constructor}}%

\pnum
A \grammarterm{declarator} declares a \defn{constructor} if it is a
function declarator\iref{dcl.fct} of the form
\begin{ncbnf}
ptr-declarator \terminal{(} parameter-declaration-clause \terminal{)} \opt{noexcept-specifier} \opt{attribute-specifier-seq}
\end{ncbnf}
where the \grammarterm{ptr-declarator} consists solely of an
\grammarterm{id-expression}, an optional \grammarterm{attribute-specifier-seq},
and optional surrounding parentheses, and the \grammarterm{id-expression} has
one of the following forms:
A \grammarterm{declaration} declares a \defn{constructor} if
\begin{itemize}
\item
in a friend declaration\iref{class.friend},
the \grammarterm{id-expression} is a \grammarterm{qualified-id}
that names a constructor\iref{class.qual};
the \grammarterm{declarator-id} is a \grammarterm{qualified-id} that
names a constructor\iref{class.qual};

\item
otherwise, in a \grammarterm{member-declaration} that belongs to the
\grammarterm{member-specification} of a class or class template,
the \grammarterm{id-expression} is the
injected-class-name\iref{class.pre} of the immediately-enclosing entity;
otherwise,
in a \grammarterm{member-declaration} that
belongs to the \grammarterm{member-specification} of a class or class template,
the \grammarterm{declarator-id} is the injected-class-name\iref{class.pre} of
the immediately-enclosing entity;

\item
otherwise, the
\grammarterm{id-expression} is a \grammarterm{qualified-id}
whose \grammarterm{unqualified-id} is
the injected-class-name of its lookup context.
otherwise,
the \grammarterm{declarator-id} is a \grammarterm{qualified-id} whose
\grammarterm{unqualified-id} is the injected-class-name of its lookup context.
\end{itemize}

The declarator of a constructor declaration shall have the form
\begin{ncbnf}
ptr-declarator \terminal{(} parameter-declaration-clause \terminal{)} \opt{noexcept-specifier} \opt{attribute-specifier-seq}
\end{ncbnf}
where the \grammarterm{ptr-declarator} consists solely of an
\grammarterm{id-expression}, an optional \grammarterm{attribute-specifier-seq},
and optional surrounding parentheses.
Constructors do not have names.
In a constructor declaration, each \grammarterm{decl-specifier} in the optional
\grammarterm{decl-specifier-seq} shall be
Expand Down Expand Up @@ -3371,8 +3394,12 @@
\indextext{class!local|see{local class}}%

\pnum
A class can be declared within a function definition; such a class is
called a \defnadj{local}{class}.
\indextext{nested class!local class}%
A class is a \defnadj{local}{class} if
\begin{itemize}
\item its declaration inhabits a block scope or
\item it is a nested class of a local class.
\end{itemize}
\begin{note}
A declaration in a local class
cannot odr-use\iref{term.odr.use}
Expand Down Expand Up @@ -3414,13 +3441,10 @@
definition, if they are defined at all.

\pnum
\indextext{nested class!local class}%
\indextext{restriction!local class}%
A class nested within
a local class is a local class.
A member of a local class \tcode{X} shall be
declared only in the definition of \tcode{X} or,
if the member is a nested class,
if the member is an enumeration or a nested class,
in the nearest enclosing block scope of \tcode{X}.

\pnum
Expand Down Expand Up @@ -3669,10 +3693,12 @@
class specifier that contains the keyword \keyword{virtual} specifies a
\defnadj{virtual}{base class}. For each distinct occurrence of a
non-virtual base class in the class lattice of the most derived class,
the most derived object\iref{intro.object} shall contain a
the most derived object\iref{intro.object} contains a
corresponding distinct base class subobject of that type. For each
distinct base class that is specified virtual, the most derived object
shall contain a single base class subobject of that type.
contains a single base class subobject of that type.
A \defnadj{transitively virtual}{base class} is
a virtual base class or a base class thereof.

\pnum
\begin{note}
Expand Down Expand Up @@ -5843,9 +5869,9 @@
\grammarterm{mem-initializer}{s}
for base classes have completed,
\item
a precondition assertion of a constructor, or
a precondition assertion of a constructor of the object under construction, or
\item
a postcondition assertion of a destructor\iref{dcl.contract.func},
a postcondition assertion of the destructor of the object under destruction\iref{dcl.contract.func},
\end{itemize}
the program has undefined behavior\ubdef{class.base.init.mem.fun}.
\begin{example}
Expand Down Expand Up @@ -6850,4 +6876,39 @@
\end{codeblock}
\end{example}

\rSec2[class.mem.ambig]{Ambiguity resolution}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolution says to put this "Add a new subclause at the end of 11.4 [class.mem]" , but this is end of [class.compare]

I think it should go after [class.nest], just before \rSec1[class.union]


\pnum
An ambiguity can arise in a \grammarterm{member-declaration} when
a \grammarterm{type-name} is enclosed in parentheses.
In this case, the choice is between
the declaration of a function with an unnamed parameter and
the declaration of a member with redundant parentheses
around the \grammarterm{declarator-id}.
If the former interpretation would declare a function whose
name is the injected-class-name of
the enclosing class or class template and
its \grammarterm{decl-specifier-seq}, if present,
would contain neither friend nor a \grammarterm{decl-specifier} that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\keyword friend?

is not permitted for a constructor\iref{class.ctor.general},
the former interpretation is chosen
(i.e. the \grammarterm{type-name}

Check failure on line 6895 in source/classes.tex

View workflow job for this annotation

GitHub Actions / Run checks on Linux

classes.tex:6895:"i.e." must be followed by a comma: (i.e. the \grammarterm{type-name}

Check failure on line 6895 in source/classes.tex

View workflow job for this annotation

GitHub Actions / Run checks on Linux

classes.tex:6895:"i.e." must be followed by a comma: (i.e. the \grammarterm{type-name}
is considered a \grammarterm{simple-type-specifier}
rather than a \grammarterm{declarator-id});
otherwise, the latter interpretation is chosen.
As in \ref{stmt.ambig}, the disambiguation
is purely syntactic and
can result in an ill-formed interpretation.
\begin{example}
\begin{codeblock}
typedef int t1, t2;
template<class> struct u1;
struct A {
A(t1); // OK, declares constructor having unnamed parameter of type \tcode{int}, not a data member named \tcode{t1}
typedef A(t2); // OK, declares \tcode{t2} as an alias for \tcode{A}
A(u1); // error: placeholder for deduced class type cannot appear in this context\iref{dcl.type.class.deduct}
};
\end{codeblock}
\end{example}

\indextext{class|)}
24 changes: 24 additions & 0 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2986,6 +2986,30 @@
names are referred to outside the \keyword{struct}.
The latter is probably rare.

\diffref{basic.scope.block}
\change
Names declared in the outermost block scope of a \keyword{for} loop
conflict with those declared in its \grammarterm{init-statement}.
\begin{example}
\begin{codeblock}
void f() {
for (int i = 0; ; ) {
long i = 1; // valid C, invalid \Cpp
// ...
}
}
\end{codeblock}
\end{example}
\rationale
C99 introduced the possibility to declare variables in a \keyword{for} loop,
but did not add the \Cpp{} rule about conflicting declarations.
\effect
Change to semantics of well-defined feature.
\difficulty
Semantic transformation.
\howwide
Seldom.

\diffref{basic.link} [also \ref{dcl.type}]
\change
A name of file scope that is explicitly declared \keyword{const}, and not explicitly
Expand Down
Loading
Loading