Skip to content

Commit f5ebcca

Browse files
authored
Merge 2018-06 CWG Motion 5
Fixes #2117
2 parents 980486e + 5cca3b5 commit f5ebcca

File tree

8 files changed

+60
-49
lines changed

8 files changed

+60
-49
lines changed

source/basic.tex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@
262262

263263
\pnum
264264
\indextext{type!incomplete}%
265-
A program is ill-formed if the definition of any object gives the object
266-
an incomplete type\iref{basic.types}.
265+
In the definition of an object,
266+
the type of that object shall not be
267+
an incomplete type\iref{basic.types},
268+
an abstract class type\iref{class.abstract}, or
269+
a (possibly multi-dimensional) array thereof.
267270

268271
\indextext{object!definition}%
269272
\indextext{function!definition}%

source/classes.tex

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,15 @@
649649

650650
\pnum
651651
\indextext{class object!member}%
652-
Non-static data members shall not have
653-
incomplete types. In particular, a class \tcode{C} shall not contain a
654-
non-static member of class \tcode{C}, but it can contain a pointer or
655-
reference to an object of class \tcode{C}.
652+
The type of a non-static data member shall not be an
653+
incomplete type\iref{basic.types},
654+
an abstract class type\iref{class.abstract},
655+
or a (possibly multi-dimensional) array thereof.
656+
\begin{note}
657+
In particular, a class \tcode{C} cannot contain
658+
a non-static member of class \tcode{C},
659+
but it can contain a pointer or reference to an object of class \tcode{C}.
660+
\end{note}
656661

657662
\pnum
658663
\begin{note}

source/declarations.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@
14131413
If the operand of a \grammarterm{decltype-specifier} is a prvalue,
14141414
the temporary materialization conversion is not applied\iref{conv.rval}
14151415
and no result object is provided for the prvalue.
1416-
The type of the prvalue may be incomplete.
1416+
The type of the prvalue may be incomplete or an abstract class type.
14171417
\begin{note}
14181418
As a result, storage is not allocated for the prvalue and it is not destroyed.
14191419
Thus, a class type is not instantiated

source/declarators.tex

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@
972972
is called the array
973973
\term{element type};
974974
this type shall not be a reference type, \cv{}~\tcode{void},
975-
a function type or an abstract class type.
975+
or a function type.
976976
\indextext{declaration!array}%
977977
If the
978978
\grammarterm{constant-expression}\iref{expr.const}
@@ -1478,12 +1478,6 @@
14781478

14791479
\pnum
14801480
Types shall not be defined in return or parameter types.
1481-
The type of a parameter or the return type for a function
1482-
definition shall not be an incomplete
1483-
(possibly cv-qualified) class type
1484-
in the context of the function definition
1485-
unless the function is
1486-
deleted\iref{dcl.fct.def.delete}.
14871481

14881482
\pnum
14891483
\indextext{typedef!function}%
@@ -1989,6 +1983,11 @@
19891983
shall be a well-formed function declaration
19901984
as described in~\ref{dcl.fct}.
19911985
A function shall be defined only in namespace or class scope.
1986+
The type of a parameter or the return type for a function
1987+
definition shall not be
1988+
an incomplete or abstract (possibly cv-qualified) class type
1989+
in the context of the function definition
1990+
unless the function is deleted\iref{dcl.fct.def.delete}.
19921991

19931992
\pnum
19941993
\begin{example}

source/derived.tex

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -922,16 +922,21 @@
922922
\end{note}
923923

924924
\pnum
925-
An \defnx{abstract class}{class!abstract} is a class that can be used only
926-
as a base class of some other class; no objects of an abstract class can
927-
be created except as subobjects of a class derived from it. A class is
928-
abstract if it has at least one \term{pure virtual function}.
925+
A virtual function is specified as
926+
a \defnx{pure virtual function}{function!virtual!pure} by using a
927+
\grammarterm{pure-specifier}\iref{class.mem} in the function declaration
928+
in the class definition.
929929
\begin{note}
930930
Such a function might be inherited: see below.
931931
\end{note}
932-
A virtual function is specified \defnx{pure}{function!virtual!pure} by using a
933-
\grammarterm{pure-specifier}\iref{class.mem} in the function declaration
934-
in the class definition.
932+
A class is an \defnx{abstract class}{class!abstract}
933+
if it has at least one pure virtual function.
934+
\begin{note}
935+
An abstract class can be used only as a base class of some other class;
936+
no objects of an abstract class can be created
937+
except as subobjects of a class
938+
derived from it~(\ref{basic.def}, \ref{class.mem}).
939+
\end{note}
935940
\indextext{definition!pure virtual function}%
936941
A pure virtual function need be defined only if called with, or as if
937942
with\iref{class.dtor}, the \grammarterm{qualified-id}
@@ -962,19 +967,18 @@
962967
\end{example}
963968

964969
\pnum
965-
\indextext{class!pointer to abstract}%
966-
An abstract class shall not be used as a parameter type, as a function
967-
return type, or as the type of an explicit conversion. Pointers and
968-
references to an abstract class can be declared.
969-
\begin{example}
970-
\begin{codeblock}
971-
shape x; // error: object of abstract class
972-
shape* p; // OK
973-
shape f(); // error
974-
void g(shape); // error
975-
shape& h(shape&); // OK
976-
\end{codeblock}
977-
\end{example}
970+
\begin{note}
971+
An abstract class type cannot be used
972+
as a parameter or return type of
973+
a function being defined\iref{dcl.fct} or called\iref{expr.call},
974+
except as specified in \ref{dcl.type.simple}.
975+
Further, an abstract class type cannot be used as
976+
the type of an explicit type conversion~(\ref{expr.static.cast},
977+
\ref{expr.reinterpret.cast}, \ref{expr.const.cast}),
978+
because the resulting prvalue would be of abstract class type\iref{basic.lval}.
979+
However, pointers and references to abstract class types
980+
can appear in such contexts.
981+
\end{note}
978982

979983
\pnum
980984
\indextext{function!virtual!pure}%

source/exceptions.tex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,11 @@
260260
An lvalue denoting the temporary is used to initialize the
261261
variable declared in the matching
262262
\grammarterm{handler}\iref{except.handle}.
263-
If the type of the exception object would
264-
be an incomplete type or a pointer to an incomplete
265-
type other than \cv{}~\tcode{void} the program is ill-formed.
263+
If the type of the exception object would be
264+
an incomplete type,
265+
an abstract class type\iref{class.abstract},
266+
or a pointer to an incomplete type other than \cv{}~\tcode{void}
267+
the program is ill-formed.
266268

267269
\pnum
268270
\indextext{exception handling!memory}%

source/expressions.tex

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,10 @@
213213
and rvalues in other significant contexts.
214214

215215
\pnum
216-
Unless otherwise indicated\iref{expr.call},
217-
a prvalue shall always have complete type or the \tcode{void} type.
216+
Unless otherwise indicated\iref{dcl.type.simple},
217+
a prvalue shall always have complete type or the \tcode{void} type;
218+
if it has a class type or (possibly multi-dimensional) array of class type,
219+
that class shall not be an abstract class\iref{class.abstract}.
218220
A glvalue shall not have type \cv{}~\tcode{void}.
219221
\begin{note}
220222
A glvalue may have complete or incomplete non-\tcode{void} type.
@@ -2264,12 +2266,12 @@
22642266
See~\ref{class.member.lookup}, \ref{class.access.base},
22652267
and~\ref{expr.ref}.
22662268
\end{note}
2267-
When a function is called, the parameters that have object type shall
2268-
have completely-defined object type.
2269+
When a function is called, the type of any parameter
2270+
shall not be a class type that is either incomplete or abstract.
22692271
\begin{note}
2270-
this still allows a parameter to be a pointer or reference to an
2271-
incomplete class type. However, it prevents a passed-by-value parameter
2272-
to have an incomplete class type.
2272+
This still allows a parameter to be a pointer or reference to such
2273+
a type. However, it prevents a passed-by-value parameter
2274+
to have an incomplete or abstract class type.
22732275
\end{note}
22742276
It is \impldef{whether the lifetime of a parameter ends when the callee
22752277
returns or at the end of the enclosing full-expression} whether the

source/templates.tex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7282,7 +7282,7 @@
72827282
\item Attempting to instantiate a pack expansion containing multiple packs of differing lengths.
72837283
\item
72847284
Attempting to create an array with an element type that is \tcode{void}, a
7285-
function type, a reference type, or an abstract class type, or attempting
7285+
function type, or a reference type, or attempting
72867286
to create an array with a size that is zero or negative.
72877287
\begin{example}
72887288
\begin{codeblock}
@@ -7376,10 +7376,6 @@
73767376
Attempting to create a function type in which a parameter has a type
73777377
of \tcode{void}, or in which the return type is a function type
73787378
or array type.
7379-
7380-
\item
7381-
Attempting to create a function type in which a parameter type or the return type is an
7382-
abstract class type\iref{class.abstract}.
73837379
\end{itemize}
73847380
\end{note}
73857381

0 commit comments

Comments
 (0)