Skip to content

Commit 4df64b4

Browse files
committed
CWG2448 Cv-qualification of arithmetic types and deprecation of volatile
1 parent a71c798 commit 4df64b4

File tree

2 files changed

+47
-69
lines changed

2 files changed

+47
-69
lines changed

source/basic.tex

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5014,9 +5014,10 @@
50145014
Types
50155015
\keyword{bool},
50165016
\keyword{char}, \keyword{wchar_t},
5017-
\keyword{char8_t}, \keyword{char16_t}, \keyword{char32_t},
5018-
and the signed and unsigned integer types are
5019-
collectively called
5017+
\keyword{char8_t}, \keyword{char16_t}, \keyword{char32_t}, and
5018+
the signed and unsigned integer types,
5019+
and cv-qualified versions\iref{basic.type.qualifier} thereof,
5020+
are collectively termed
50205021
\defnx{integral types}{integral type}.
50215022
A synonym for integral type is \defn{integer type}.
50225023
\begin{note}
@@ -5027,19 +5028,26 @@
50275028

50285029
\pnum
50295030
\indextext{floating-point type|see{type, floating-point}}%
5030-
There are three \defnx{floating-point types}{type!floating-point}:
5031+
The three distinct types
50315032
\indextext{type!\idxcode{float}}%
50325033
\keyword{float},
50335034
\indextext{type!\idxcode{double}}%
50345035
\keyword{double},
50355036
and
50365037
\indextext{type!\idxcode{long double}}%
5037-
\tcode{\keyword{long} \keyword{double}}. The type \keyword{double} provides at least as much
5038+
\tcode{\keyword{long} \keyword{double}}
5039+
can represent floating-point numbers.
5040+
The type \keyword{double} provides at least as much
50385041
precision as \keyword{float}, and the type \tcode{\keyword{long} \keyword{double}} provides at
50395042
least as much precision as \keyword{double}. The set of values of the type
50405043
\keyword{float} is a subset of the set of values of the type
50415044
\keyword{double}; the set of values of the type \keyword{double} is a subset
5042-
of the set of values of the type \tcode{\keyword{long} \keyword{double}}. The value
5045+
of the set of values of the type \tcode{\keyword{long} \keyword{double}}.
5046+
The types
5047+
\keyword{float}, \keyword{double}, and \tcode{\keyword{long} \keyword{double}},
5048+
and cv-qualified versions\iref{basic.type.qualifier} thereof,
5049+
are collectively termed \defnx{floating-point types}{type!floating-point}.
5050+
The value
50435051
representation of floating-point types is \impldef{value representation of
50445052
floating-point types}.
50455053
\indextext{floating-point type!implementation-defined}%
@@ -5048,7 +5056,7 @@
50485056
floating-point operations; see also~\ref{support.limits}.
50495057
\end{note}
50505058
Integral and floating-point types are collectively
5051-
called \defnx{arithmetic}{type!arithmetic} types.
5059+
termed \defnx{arithmetic types}{type!arithmetic}.
50525060
\indextext{\idxcode{numeric_limits}!specializations for arithmetic types}%
50535061
Specializations of the standard library template
50545062
\tcode{std::numeric_limits}\iref{support.limits} shall specify the
@@ -5267,18 +5275,22 @@
52675275
\indextext{cv-qualifier}%
52685276
\indextext{\idxcode{const}}%
52695277
\indextext{\idxcode{volatile}}%
5270-
A type mentioned in~\ref{basic.fundamental} and~\ref{basic.compound} is
5271-
a \defnadj{cv-unqualified}{type}. Each type which is a
5272-
cv-unqualified object type or is
5273-
\keyword{void}\iref{basic.types} has three corresponding cv-qualified
5274-
versions of its type: a \defn{const-qualified} version, a
5275-
\defn{volatile-qualified} version, and a
5276-
\defn{const-volatile-qualified} version. The
5277-
type of an object\iref{intro.object} includes the \grammarterm{cv-qualifier}{s}
5278-
specified in the \grammarterm{decl-specifier-seq}\iref{dcl.spec},
5279-
\grammarterm{declarator}\iref{dcl.decl},
5280-
\grammarterm{type-id}\iref{dcl.name}, or
5281-
\grammarterm{new-type-id}\iref{expr.new} when the object is created.
5278+
Each type other than a function or reference type
5279+
is part of a group of four distinct, but related, types:
5280+
a \defn{cv-unqualified} version,
5281+
a \defn{const-qualified} version,
5282+
a \defn{volatile-qualified} version, and
5283+
a \defn{const-volatile-qualified} version.
5284+
The types in each such group shall have
5285+
the same representation and alignment requirements\iref{basic.align}.
5286+
\begin{footnote}
5287+
The same representation and alignment requirements
5288+
are meant to imply interchangeability as
5289+
arguments to functions,
5290+
return values from functions, and
5291+
non-static data members of unions.
5292+
\end{footnote}
5293+
A function or reference type is always cv-unqualified.
52825294
\begin{itemize}
52835295
\item A \defnadj{const}{object} is an object of type \tcode{\keyword{const} T} or a
52845296
non-mutable subobject of a const object.
@@ -5291,16 +5303,15 @@
52915303
a const subobject of a volatile object, or a non-mutable volatile
52925304
subobject of a const object.
52935305
\end{itemize}
5294-
The cv-qualified or
5295-
cv-unqualified versions of a type
5296-
are distinct types; however, they shall have the same representation and
5297-
alignment requirements\iref{basic.align}.
5298-
\begin{footnote}
5299-
The same representation
5300-
and alignment requirements are meant to imply
5301-
interchangeability as arguments to functions, return values from
5302-
functions, and non-static data members of unions.
5303-
\end{footnote}
5306+
\begin{note}
5307+
The type of an object\iref{intro.object} includes
5308+
the \grammarterm{cv-qualifier}s specified in the
5309+
\grammarterm{decl-specifier-seq}\iref{dcl.spec},
5310+
\grammarterm{declarator}\iref{dcl.decl},
5311+
\grammarterm{type-id}\iref{dcl.name}, or
5312+
\grammarterm{new-type-id}\iref{expr.new}
5313+
when the object is created.
5314+
\end{note}
53045315

53055316
\pnum
53065317
Except for array types, a compound type\iref{basic.compound} is not cv-qualified by the

source/overloading.tex

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3409,7 +3409,7 @@
34093409
\indextext{type!arithmetic!promoted}%
34103410
In this subclause, the term
34113411
\defn{promoted integral type}
3412-
is used to refer to those integral types which are preserved by
3412+
is used to refer to those cv-unqualified integral types which are preserved by
34133413
integral promotion\iref{conv.prom} (including e.g.
34143414
\tcode{int}
34153415
and
@@ -3432,53 +3432,20 @@
34323432
\cvqual{vq}),
34333433
where
34343434
\tcode{\placeholder{T}}
3435-
is an arithmetic type other than \tcode{bool},
3435+
is a cv-unqualified arithmetic type other than \tcode{bool}
3436+
or a cv-unqualified pointer to (possibly cv-qualified) object type,
34363437
there exist candidate operator functions of the form
34373438
\begin{codeblock}
34383439
@\cvqual{vq} \placeholder{T}@& operator++(@\cvqual{vq} \placeholder{T}@&);
34393440
@\placeholder{T}@ operator++(@\cvqual{vq} \placeholder{T}@&, int);
3440-
\end{codeblock}
3441-
3442-
\pnum
3443-
For every pair
3444-
(\tcode{\placeholder{T}},
3445-
\cvqual{vq}),
3446-
where
3447-
\tcode{\placeholder{T}}
3448-
is an arithmetic type other than
3449-
\tcode{bool},
3450-
there exist candidate operator functions of the form
3451-
\begin{codeblock}
34523441
@\cvqual{vq} \placeholder{T}@& operator--(@\cvqual{vq} \placeholder{T}@&);
34533442
@\placeholder{T}@ operator--(@\cvqual{vq} \placeholder{T}@&, int);
34543443
\end{codeblock}
34553444

34563445
\pnum
3457-
For every pair
3458-
(\tcode{\placeholder{T}},
3459-
\cvqual{vq}),
3460-
where
3461-
\tcode{\placeholder{T}}
3462-
is a cv-qualified or cv-unqualified object type,
3463-
there exist candidate operator functions of the form
3464-
\begin{codeblock}
3465-
@\placeholder{T}@*@\cvqual{vq}@& operator++(@\placeholder{T}@*@\cvqual{vq}@&);
3466-
@\placeholder{T}@*@\cvqual{vq}@& operator--(@\placeholder{T}@*@\cvqual{vq}@&);
3467-
@\placeholder{T}@* operator++(@\placeholder{T}@*@\cvqual{vq}@&, int);
3468-
@\placeholder{T}@* operator--(@\placeholder{T}@*@\cvqual{vq}@&, int);
3469-
\end{codeblock}
3470-
3471-
\pnum
3472-
For every cv-qualified or cv-unqualified object type
3473-
\tcode{\placeholder{T}},
3474-
there exist candidate operator functions of the form
3475-
\begin{codeblock}
3476-
@\placeholder{T}@& operator*(@\placeholder{T}@*);
3477-
\end{codeblock}
3478-
3479-
\pnum
3480-
For every function type
3481-
\tcode{\placeholder{T}} that does not have cv-qualifiers or a \grammarterm{ref-qualifier},
3446+
For every (possibly cv-qualified) object type \tcode{\placeholder{T}} and
3447+
for every function type \tcode{\placeholder{T}}
3448+
that has neither \grammarterm{cv-qualifier}s nor a \grammarterm{ref-qualifier},
34823449
there exist candidate operator functions of the form
34833450
\begin{codeblock}
34843451
@\placeholder{T}@& operator*(@\placeholder{T}@*);
@@ -3491,7 +3458,7 @@
34913458
\end{codeblock}
34923459

34933460
\pnum
3494-
For every floating-point or promoted integral type \tcode{\placeholder{T}},
3461+
For every cv-unqualified floating-point or promoted integral type \tcode{\placeholder{T}},
34953462
there exist candidate operator functions of the form
34963463
\begin{codeblock}
34973464
@\placeholder{T}@ operator+(@\placeholder{T}@);

0 commit comments

Comments
 (0)