From Jason Turner

[bit.cast]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpow7xf4fp/{from.md → to.md} +27 -14
tmp/tmpow7xf4fp/{from.md → to.md} RENAMED
@@ -9,31 +9,44 @@ template<class To, class From>
9
 
10
  - `sizeof(To) == sizeof(From)` is `true`;
11
  - `is_trivially_copyable_v<To>` is `true`; and
12
  - `is_trivially_copyable_v<From>` is `true`.
13
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  *Returns:* An object of type `To`. Implicitly creates objects nested
15
  within the result [[intro.object]]. Each bit of the value representation
16
  of the result is equal to the corresponding bit in the object
17
  representation of `from`. Padding bits of the result are unspecified.
18
  For the result and each object created within it, if there is no value
19
  of the object’s type corresponding to the value representation produced,
20
  the behavior is undefined. If there are multiple such values, which
21
  value is produced is unspecified. A bit in the value representation of
22
  the result is indeterminate if it does not correspond to a bit in the
23
- value representation of `from` or corresponds to a bit of an object that
24
- is not within its lifetime or has an indeterminate
25
- value [[basic.indet]]. For each bit in the value representation of the
26
- result that is indeterminate, the smallest object containing that bit
27
- has an indeterminate value; the behavior is undefined unless that object
28
- is of unsigned ordinary character type or `std::byte` type. The result
29
- does not otherwise contain any indeterminate values.
30
 
31
- *Remarks:* This function is `constexpr` if and only if `To`, `From`, and
32
- the types of all subobjects of `To` and `From` are types `T` such that:
 
 
 
 
33
 
34
- - `is_union_v<T>` is `false`;
35
- - `is_pointer_v<T>` is `false`;
36
- - `is_member_pointer_v<T>` is `false`;
37
- - `is_volatile_v<T>` is `false`; and
38
- - `T` has no non-static data members of reference type.
39
 
 
9
 
10
  - `sizeof(To) == sizeof(From)` is `true`;
11
  - `is_trivially_copyable_v<To>` is `true`; and
12
  - `is_trivially_copyable_v<From>` is `true`.
13
 
14
+ *Mandates:* Neither `To` nor `From` are consteval-only
15
+ types [[basic.types.general]].
16
+
17
+ `To`, `From`, and the types of all subobjects of `To` and `From` are
18
+ types `T` such that:
19
+
20
+ - `is_union_v<T>` is `false`;
21
+ - `is_pointer_v<T>` is `false`;
22
+ - `is_member_pointer_v<T>` is `false`;
23
+ - `is_volatile_v<T>` is `false`; and
24
+ - `T` has no non-static data members of reference type.
25
+
26
  *Returns:* An object of type `To`. Implicitly creates objects nested
27
  within the result [[intro.object]]. Each bit of the value representation
28
  of the result is equal to the corresponding bit in the object
29
  representation of `from`. Padding bits of the result are unspecified.
30
  For the result and each object created within it, if there is no value
31
  of the object’s type corresponding to the value representation produced,
32
  the behavior is undefined. If there are multiple such values, which
33
  value is produced is unspecified. A bit in the value representation of
34
  the result is indeterminate if it does not correspond to a bit in the
35
+ value representation of `from` or corresponds to a bit for which the
36
+ smallest enclosing object is not within its lifetime or has an
37
+ indeterminate value [[basic.indet]]. A bit in the value representation
38
+ of the result is erroneous if it corresponds to a bit for which the
39
+ smallest enclosing object has an erroneous value. For each bit b in the
40
+ value representation of the result that is indeterminate or erroneous,
41
+ let u be the smallest object containing that bit enclosing b:
42
 
43
+ - If u is of unsigned ordinary character type or `std::byte` type, u has
44
+ an indeterminate value if any of the bits in its value representation
45
+ are indeterminate, or otherwise has an erroneous value.
46
+ - Otherwise, if b is indeterminate, the behavior is undefined.
47
+ - Otherwise, the behavior is erroneous, and the result is as specified
48
+ above.
49
 
50
+ The result does not otherwise contain any indeterminate or erroneous
51
+ values.
 
 
 
52