Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


2448. Cv-qualification of arithmetic types and deprecation of volatile

Section:6.9.2  [basic.fundamental]    Status:CD6    Submitter:Alisdair Meredith    Date:2020-03-23

[Accepted as a DR at the June, 2021 meeting.]

According to the definitions in 6.9.2 [basic.fundamental],the arithmetic types include only the non-cv-qualified versions.In the taxonomy of fundamental types, the first mention of“cv-qualified versions of these types” is forscalar types (6.9 [basic.types] paragraph 9). However,7.6.1.6 [expr.post.incr] paragraph 1 and7.6.2.3 [expr.pre.incr] paragraph 1 both say:

The type of the operand shall be an arithmetic type otherthancvbool, or...

which is a contradiction, since cv-qualifiedboolis not an arithmetic type. Similarly, 7.6.19 [expr.assign] paragraph 6requires an arithmetic type for+=and-=. D.4 [depr.volatile.type] deprecatesthe increment and decrement operators when applied tovolatile-qualified arithmetic types, but the wording alreadymade those ill-formed (since the normative wording requiresan arithmetic type and not a possibly cv-qualified versionthereof).

A related question is whether 12.5 [over.built],which explicitly allows for cv-qualified arithmetic types,should also note the deprecation.

See alsoissue 2185.

Notes from the July, 2020 teleconference:

CWG felt that no changes should be made to12.5 [over.built].

Proposed resolution (April, 2021):

  1. Change 6.9.2 [basic.fundamental] paragraphs 11 and 12 as follows,splitting paragraph 12 as indicated:

  2. Typesbool,char,wchar_t,char8_t,char16_t,char32_t, andthe signed and unsigned integer types, and cv-qualifiedversions (6.9.5 [basic.type.qualifier]) thereof, arecollectivelycalledtermedintegral types. A synonym for integral typeisinteger type. [Note 8: Enumerations(9.8.1 [dcl.enum]) are not integral; however,unscoped enumerations can be promoted to integral types asspecified in 7.3.7 [conv.prom]. —endnote]

    There arethree floating-point types:The three distinct typesfloat,double, andlong doublecan representfloating-point numbers. The typedoubleprovides at least as much precision asfloat, and the typelong double provides at least as much precision asdouble. The set of values of thetypefloat is a subset of the set of values of thetypedouble; the set of values of thetypedouble is a subset of the set of values of thetypelong double.The typesfloat,double, andlong double, and cv-qualifiedversions (6.9.5 [basic.type.qualifier]) thereof, arecollectively termedfloating-point types. Thevalue representation of floating-point types isimplementation-defined.[Note 9: This documentimposes no requirements on the accuracy of floating-pointoperations; see also17.3 [support.limits]. —end note]

    Integral and floating-point types arecollectivelycalledtermedarithmetic types. Specializations of the standardlibrary templatestd::numeric_limits(17.3 [support.limits]) shall specify the maximum andminimum values of each arithmetic type for animplementation.

  3. Change 6.9.5 [basic.type.qualifier] paragraph 1 as follows,splitting the paragraph as indicated:

  4. A type mentioned in 6.9.2 [basic.fundamental] and6.9.4 [basic.compound] is acv-unqualifiedtype. Each typewhich is a cv-unqualified object typeor isvoid (6.9 [basic.types]) has threecorresponding cv-qualified versions of its typeother than a function or reference type is part of agroup of four distinct, but related,types:acv-unqualified version,aconst-qualified version,avolatile-qualified version, andaconst-volatile-qualified version.The type of an object (6.8.2 [intro.object])includes thecv-qualifiers specified inthedecl-specifier-seq (9.2 [dcl.spec]),declarator (9.3 [dcl.decl]),type-id(9.3.2 [dcl.name]), ornew-type-id(7.6.2.8 [expr.new]) when the object iscreated.The types in each such group shall havethe same representation and alignment requirements(6.8.3 [basic.align]). [Footnote: The samerepresentation and alignment requirements are meant to implyinterchangeability as arguments to functions, return valuesfrom functions, and non-static data members ofunions. —end footnote] A function or referencetype is always cv-unqualified.

    The cv-qualified or cv-unqualified versions of atype are distinct types; however, they shall have the samerepresentation and alignment requirements(6.8.3 [basic.align]).40[Note:The type of an object (6.8.2 [intro.object]) includesthecv-qualifiers specified in thedecl-specifier-seq (9.2 [dcl.spec]),declarator (9.3 [dcl.decl]),type-id(9.3.2 [dcl.name]), ornew-type-id(7.6.2.8 [expr.new]) when the object is created.—end note]

  5. Change 12.5 [over.built] paragraphs 2-10 as follows:

  6. In this subclause, the termpromoted integral typeis used to refer to thosecv-unqualified integraltypes which are preserved by integral promotion(7.3.7 [conv.prom]) (including e.g.intandlong but excluding e.g.char). [Note 2: In all cases where a promoted integraltype is required, an operand of unscoped enumeration typewill be acceptable by way of the integralpromotions. —end note]

    In the remainder of this subclause,vqrepresents eithervolatile or no cv-qualifier.

    For every pair (T, vq), whereT isana cv-unqualified arithmetic type otherthanboolor a cv-unqualified pointer to(possibly cv-qualified) object type, there existcandidate operator functions of the form

    For every pair (T, vq), whereT is anarithmetic type other thanbool, there existcandidate operator functions of the form

    For every pair (T, vq), whereT is acv-qualified or cv-unqualified object type, there existcandidate operator functions of the form

    For everycv-qualified or cv-unqualified(possibly cv-qualified) object typeTand for every function typeT that has neithercv-qualifiers nor aref-qualifier,there exist candidate operator functions of the form

    For every function typeT that does not havecv-qualifiers or a ref-qualifier, there exist candidateoperator functions of the form

    For every typeT there exist candidate operatorfunctions of the form

    For everycv-unqualified floating-point orpromoted integral typeT, there exist candidateoperator functions of the form

[Drafting note: Clause 21 [meta] regardingtype traits appropriately handles cv-qualified andcv-unqualified types and does not require revision.]




[8]ページ先頭

©2009-2026 Movatter.jp