From Jason Turner

[basic.types.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqrv7ikab/{from.md → to.md} +46 -26
tmp/tmpqrv7ikab/{from.md → to.md} RENAMED
@@ -8,11 +8,11 @@ functions [[dcl.fct]]. — *end note*]
8
 
9
  For any object (other than a potentially-overlapping subobject) of
10
  trivially copyable type `T`, whether or not the object holds a valid
11
  value of type `T`, the underlying bytes [[intro.memory]] making up the
12
  object can be copied into an array of `char`, `unsigned char`, or
13
- `std::byte` [[cstddef.syn]].[^14]
14
 
15
  If the content of that array is copied back into the object, the object
16
  shall subsequently hold its original value.
17
 
18
  [*Example 1*:
@@ -28,11 +28,11 @@ std::memcpy(&obj, buf, N); // at this point, each subobject of obj of scala
28
  — *end example*]
29
 
30
  For two distinct objects `obj1` and `obj2` of trivially copyable type
31
  `T`, where neither `obj1` nor `obj2` is a potentially-overlapping
32
  subobject, if the underlying bytes [[intro.memory]] making up `obj1` are
33
- copied into `obj2`,[^15]
34
 
35
  `obj2` shall subsequently hold the same value as `obj1`.
36
 
37
  [*Example 2*:
38
 
@@ -45,23 +45,31 @@ std::memcpy(t1p, t2p, sizeof(T));
45
  // the same value as the corresponding subobject in *t2p
46
  ```
47
 
48
  — *end example*]
49
 
50
- The *object representation* of an object of type `T` is the sequence of
51
- *N* `unsigned char` objects taken up by the object of type `T`, where
52
- *N* equals `sizeof(T)`. The *value representation* of an object of type
53
- `T` is the set of bits that participate in representing a value of type
54
- `T`. Bits in the object representation that are not part of the value
55
- representation are *padding bits*. For trivially copyable types, the
56
- value representation is a set of bits in the object representation that
57
- determines a *value*, which is one discrete element of an
58
- *implementation-defined* set of values.[^16]
 
 
 
 
 
 
 
 
59
 
60
  A class that has been declared but not defined, an enumeration type in
61
  certain contexts [[dcl.enum]], or an array of unknown bound or of
62
- incomplete element type, is an *incompletely-defined object type*.[^17]
63
 
64
  Incompletely-defined object types and cv `void` are *incomplete types*
65
  [[basic.fundamental]].
66
 
67
  [*Note 2*: Objects cannot be defined to have an incomplete type
@@ -119,34 +127,36 @@ contexts incomplete types are prohibited. — *end note*]
119
 
120
  An *object type* is a (possibly cv-qualified) type that is not a
121
  function type, not a reference type, and not cv `void`.
122
 
123
  Arithmetic types [[basic.fundamental]], enumeration types, pointer
124
- types, pointer-to-member types [[basic.compound]], `std::nullptr_t`, and
125
- cv-qualified [[basic.type.qualifier]] versions of these types are
126
- collectively called *scalar types*. Scalar types, trivially copyable
127
- class types [[class.prop]], arrays of such types, and cv-qualified
128
- versions of these types are collectively called *trivially copyable
129
- types*. Scalar types, trivial class types [[class.prop]], arrays of such
130
- types and cv-qualified versions of these types are collectively called
131
- *trivial types*. Scalar types, standard-layout class types
132
- [[class.prop]], arrays of such types and cv-qualified versions of these
133
- types are collectively called *standard-layout types*. Scalar types,
134
- implicit-lifetime class types [[class.prop]], array types, and
135
- cv-qualified versions of these types are collectively called
136
- *implicit-lifetime types*.
 
 
137
 
138
  A type is a *literal type* if it is:
139
 
140
  - cv `void`; or
141
  - a scalar type; or
142
  - a reference type; or
143
  - an array of literal type; or
144
  - a possibly cv-qualified class type [[class]] that has all of the
145
  following properties:
146
  - it has a constexpr destructor [[dcl.constexpr]],
147
- - all of its non-static non-variant data members and base classes are
148
  of non-volatile literal types, and
149
  - it
150
  - is a closure type [[expr.prim.lambda.closure]],
151
  - is an aggregate union type that has either no variant members or
152
  at least one variant member of non-volatile literal type,
@@ -166,5 +176,15 @@ expression. — *end note*]
166
  Two types *cv1* `T1` and *cv2* `T2` are *layout-compatible types* if
167
  `T1` and `T2` are the same type, layout-compatible enumerations
168
  [[dcl.enum]], or layout-compatible standard-layout class types
169
  [[class.mem]].
170
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  For any object (other than a potentially-overlapping subobject) of
10
  trivially copyable type `T`, whether or not the object holds a valid
11
  value of type `T`, the underlying bytes [[intro.memory]] making up the
12
  object can be copied into an array of `char`, `unsigned char`, or
13
+ `std::byte` [[cstddef.syn]].[^12]
14
 
15
  If the content of that array is copied back into the object, the object
16
  shall subsequently hold its original value.
17
 
18
  [*Example 1*:
 
28
  — *end example*]
29
 
30
  For two distinct objects `obj1` and `obj2` of trivially copyable type
31
  `T`, where neither `obj1` nor `obj2` is a potentially-overlapping
32
  subobject, if the underlying bytes [[intro.memory]] making up `obj1` are
33
+ copied into `obj2`,[^13]
34
 
35
  `obj2` shall subsequently hold the same value as `obj1`.
36
 
37
  [*Example 2*:
38
 
 
45
  // the same value as the corresponding subobject in *t2p
46
  ```
47
 
48
  — *end example*]
49
 
50
+ The *object representation* of a complete object type `T` is the
51
+ sequence of *N* `unsigned char` objects taken up by a non-bit-field
52
+ complete object of type `T`, where *N* equals `sizeof(T)`. The *value
53
+ representation* of a type `T` is the set of bits in the object
54
+ representation of `T` that participate in representing a value of type
55
+ `T`. The object and value representation of a non-bit-field complete
56
+ object of type `T` are the bytes and bits, respectively, of the object
57
+ corresponding to the object and value representation of its type. The
58
+ object representation of a bit-field object is the sequence of *N* bits
59
+ taken up by the object, where *N* is the width of the bit-field
60
+ [[class.bit]]. The value representation of a bit-field object is the set
61
+ of bits in the object representation that participate in representing
62
+ its value. Bits in the object representation of a type or object that
63
+ are not part of the value representation are *padding bits*. For
64
+ trivially copyable types, the value representation is a set of bits in
65
+ the object representation that determines a *value*, which is one
66
+ discrete element of an *implementation-defined* set of values.[^14]
67
 
68
  A class that has been declared but not defined, an enumeration type in
69
  certain contexts [[dcl.enum]], or an array of unknown bound or of
70
+ incomplete element type, is an *incompletely-defined object type*.[^15]
71
 
72
  Incompletely-defined object types and cv `void` are *incomplete types*
73
  [[basic.fundamental]].
74
 
75
  [*Note 2*: Objects cannot be defined to have an incomplete type
 
127
 
128
  An *object type* is a (possibly cv-qualified) type that is not a
129
  function type, not a reference type, and not cv `void`.
130
 
131
  Arithmetic types [[basic.fundamental]], enumeration types, pointer
132
+ types, pointer-to-member types [[basic.compound]], `std::meta::{}info`,
133
+ `std::nullptr_t`, and cv-qualified [[basic.type.qualifier]] versions of
134
+ these types are collectively called *scalar types*. Scalar types,
135
+ trivially copyable class types [[class.prop]], arrays of such types, and
136
+ cv-qualified versions of these types are collectively called *trivially
137
+ copyable types*. Scalar types, trivially relocatable class types
138
+ [[class.prop]], arrays of such types, and cv-qualified versions of these
139
+ types are collectively called *trivially relocatable types*.
140
+ Cv-unqualified scalar types, replaceable class types [[class.prop]], and
141
+ arrays of such types are collectively called *replaceable types*. Scalar
142
+ types, standard-layout class types [[class.prop]], arrays of such types,
143
+ and cv-qualified versions of these types are collectively called
144
+ *standard-layout types*. Scalar types, implicit-lifetime class types
145
+ [[class.prop]], array types, and cv-qualified versions of these types
146
+ are collectively called *implicit-lifetime types*.
147
 
148
  A type is a *literal type* if it is:
149
 
150
  - cv `void`; or
151
  - a scalar type; or
152
  - a reference type; or
153
  - an array of literal type; or
154
  - a possibly cv-qualified class type [[class]] that has all of the
155
  following properties:
156
  - it has a constexpr destructor [[dcl.constexpr]],
157
+ - all of its non-variant non-static data members and base classes are
158
  of non-volatile literal types, and
159
  - it
160
  - is a closure type [[expr.prim.lambda.closure]],
161
  - is an aggregate union type that has either no variant members or
162
  at least one variant member of non-volatile literal type,
 
176
  Two types *cv1* `T1` and *cv2* `T2` are *layout-compatible types* if
177
  `T1` and `T2` are the same type, layout-compatible enumerations
178
  [[dcl.enum]], or layout-compatible standard-layout class types
179
  [[class.mem]].
180
 
181
+ A type is *consteval-only* if it is either `std::meta::info` or a type
182
+ compounded from a consteval-only type [[basic.compound]]. Every object
183
+ of consteval-only type shall be
184
+
185
+ - the object associated with a constexpr variable or a subobject
186
+ thereof,
187
+ - a template parameter object [[temp.param]] or a subobject thereof, or
188
+ - an object whose lifetime begins and ends during the evaluation of a
189
+ core constant expression.
190
+