From Jason Turner

[diff.cpp23.dcl.dcl]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpj6vxh9nx/{from.md → to.md} +70 -0
tmp/tmpj6vxh9nx/{from.md → to.md} RENAMED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### [[dcl]]: declarations <a id="diff.cpp23.dcl.dcl">[[diff.cpp23.dcl.dcl]]</a>
2
+
3
+ **Change:** Introduction of `trivially_relocatable_if_eligible` and
4
+ `replaceable_if_eligible` as identifiers with special meaning
5
+ [[lex.name]]. **Rationale:** Support declaration of trivially
6
+ relocatable and replaceable types [[class.prop]]. **Effect on original
7
+ feature:** Valid C++23 code can become ill-formed.
8
+
9
+ [*Example 1*:
10
+
11
+ ``` cpp
12
+ struct C {};
13
+ struct C replaceable_if_eligible {}; // was well-formed (new variable replaceable_if_eligible)
14
+ // now ill-formed (redefines C)
15
+ ```
16
+
17
+ — *end example*]
18
+
19
+ **Change:** Pointer comparisons between `initializer_list` objects’
20
+ backing arrays are unspecified. **Rationale:** Permit the implementation
21
+ to store backing arrays in static read-only memory. **Effect on original
22
+ feature:** Valid C++23 code that relies on the result of pointer
23
+ comparison between backing arrays may change behavior.
24
+
25
+ [*Example 2*:
26
+
27
+ ``` cpp
28
+ bool ne(std::initializer_list<int> a, std::initializer_list<int> b) {
29
+ return a.begin() != b.begin() + 1;
30
+ }
31
+ bool b = ne({2,3}, {1,2,3}); // unspecified result; previously false
32
+ ```
33
+
34
+ — *end example*]
35
+
36
+ **Change:** Previously, `T...[n]` would declare a pack of function
37
+ parameters. `T...[n]` is now a *pack-index-specifier*. **Rationale:**
38
+ Improve the handling of packs. **Effect on original feature:** Valid
39
+ C++23 code that declares a pack of parameters without specifying a
40
+ *declarator-id* becomes ill-formed.
41
+
42
+ [*Example 3*:
43
+
44
+ ``` cpp
45
+ template <typename... T>
46
+ void f(T... [1]);
47
+ template <typename... T>
48
+ void g(T... ptr[1]);
49
+ int main() {
50
+ f<int, double>(nullptr, nullptr); // ill-formed, previously void f<int, double>(int [1], double [1])
51
+ g<int, double>(nullptr, nullptr); // ok
52
+ }
53
+ ```
54
+
55
+ — *end example*]
56
+
57
+ **Change:** New token `:]`. **Rationale:** Required for new features.
58
+ **Effect on original feature:** Valid C++23 code that contained an
59
+ *attribute-specifier* with an *attribute-using-prefix* but no attributes
60
+ and no whitespace is ill-formed in this revision of C++.
61
+
62
+ [*Example 4*:
63
+
64
+ ``` cpp
65
+ struct [[using CC:]] C; // ill-formed; previously well-formed
66
+ struct [[using DD: ]] D; // OK
67
+ ```
68
+
69
+ — *end example*]
70
+