tmp/tmp8mc07orf/{from.md → to.md}
RENAMED
|
@@ -1,23 +1,28 @@
|
|
| 1 |
-
### [[dcl
|
| 2 |
|
| 3 |
**Change:** Unnamed classes with a typedef name for linkage purposes can
|
| 4 |
contain only C-compatible constructs. **Rationale:** Necessary for
|
| 5 |
implementability. **Effect on original feature:** Valid C++17 code may
|
| 6 |
-
be ill-formed in this revision of C++.
|
|
|
|
|
|
|
| 7 |
|
| 8 |
``` cpp
|
| 9 |
typedef struct {
|
| 10 |
void f() {} // ill-formed; previously well-formed
|
| 11 |
} S;
|
| 12 |
```
|
| 13 |
|
|
|
|
|
|
|
| 14 |
**Change:** A function cannot have different default arguments in
|
| 15 |
different translation units. **Rationale:** Required for modules
|
| 16 |
support. **Effect on original feature:** Valid C++17 code may be
|
| 17 |
-
ill-formed in this revision of C++, with no diagnostic required.
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
// Translation unit 1
|
| 22 |
int f(int a = 42);
|
| 23 |
int g() { return f(); }
|
|
@@ -26,17 +31,20 @@ int g() { return f(); }
|
|
| 26 |
int f(int a = 76) { return a; } // ill-formed, no diagnostic required; previously well-formed
|
| 27 |
int g();
|
| 28 |
int main() { return g(); } // used to return 42
|
| 29 |
```
|
| 30 |
|
|
|
|
|
|
|
| 31 |
**Change:** A class that has user-declared constructors is never an
|
| 32 |
aggregate. **Rationale:** Remove potentially error-prone aggregate
|
| 33 |
initialization which may apply notwithstanding the declared constructors
|
| 34 |
of a class. **Effect on original feature:** Valid C++17 code that
|
| 35 |
aggregate-initializes a type with a user-declared constructor may be
|
| 36 |
-
ill-formed or have different semantics in this revision of C++.
|
| 37 |
-
|
|
|
|
| 38 |
|
| 39 |
``` cpp
|
| 40 |
struct A { // not an aggregate; previously an aggregate
|
| 41 |
A() = delete;
|
| 42 |
};
|
|
@@ -67,14 +75,20 @@ struct Y { // not an aggregate; previously an aggregate
|
|
| 67 |
};
|
| 68 |
|
| 69 |
Y y{X{}}; // copy constructor call; previously aggregate-initialization
|
| 70 |
```
|
| 71 |
|
|
|
|
|
|
|
| 72 |
**Change:** Boolean conversion from a pointer or pointer-to-member type
|
| 73 |
is now a narrowing conversion. **Rationale:** Catches bugs. **Effect on
|
| 74 |
original feature:** Valid C++17 code may fail to compile in this
|
| 75 |
-
revision of C++.
|
|
|
|
|
|
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
bool y[] = { "bc" }; // ill-formed; previously well-formed
|
| 79 |
```
|
| 80 |
|
|
|
|
|
|
|
|
|
| 1 |
+
### [[dcl]]: declarations <a id="diff.cpp17.dcl.dcl">[[diff.cpp17.dcl.dcl]]</a>
|
| 2 |
|
| 3 |
**Change:** Unnamed classes with a typedef name for linkage purposes can
|
| 4 |
contain only C-compatible constructs. **Rationale:** Necessary for
|
| 5 |
implementability. **Effect on original feature:** Valid C++17 code may
|
| 6 |
+
be ill-formed in this revision of C++.
|
| 7 |
+
|
| 8 |
+
[*Example 1*:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
typedef struct {
|
| 12 |
void f() {} // ill-formed; previously well-formed
|
| 13 |
} S;
|
| 14 |
```
|
| 15 |
|
| 16 |
+
— *end example*]
|
| 17 |
+
|
| 18 |
**Change:** A function cannot have different default arguments in
|
| 19 |
different translation units. **Rationale:** Required for modules
|
| 20 |
support. **Effect on original feature:** Valid C++17 code may be
|
| 21 |
+
ill-formed in this revision of C++, with no diagnostic required.
|
| 22 |
+
|
| 23 |
+
[*Example 2*:
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
// Translation unit 1
|
| 27 |
int f(int a = 42);
|
| 28 |
int g() { return f(); }
|
|
|
|
| 31 |
int f(int a = 76) { return a; } // ill-formed, no diagnostic required; previously well-formed
|
| 32 |
int g();
|
| 33 |
int main() { return g(); } // used to return 42
|
| 34 |
```
|
| 35 |
|
| 36 |
+
— *end example*]
|
| 37 |
+
|
| 38 |
**Change:** A class that has user-declared constructors is never an
|
| 39 |
aggregate. **Rationale:** Remove potentially error-prone aggregate
|
| 40 |
initialization which may apply notwithstanding the declared constructors
|
| 41 |
of a class. **Effect on original feature:** Valid C++17 code that
|
| 42 |
aggregate-initializes a type with a user-declared constructor may be
|
| 43 |
+
ill-formed or have different semantics in this revision of C++.
|
| 44 |
+
|
| 45 |
+
[*Example 3*:
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
struct A { // not an aggregate; previously an aggregate
|
| 49 |
A() = delete;
|
| 50 |
};
|
|
|
|
| 75 |
};
|
| 76 |
|
| 77 |
Y y{X{}}; // copy constructor call; previously aggregate-initialization
|
| 78 |
```
|
| 79 |
|
| 80 |
+
— *end example*]
|
| 81 |
+
|
| 82 |
**Change:** Boolean conversion from a pointer or pointer-to-member type
|
| 83 |
is now a narrowing conversion. **Rationale:** Catches bugs. **Effect on
|
| 84 |
original feature:** Valid C++17 code may fail to compile in this
|
| 85 |
+
revision of C++.
|
| 86 |
+
|
| 87 |
+
[*Example 4*:
|
| 88 |
|
| 89 |
``` cpp
|
| 90 |
bool y[] = { "bc" }; // ill-formed; previously well-formed
|
| 91 |
```
|
| 92 |
|
| 93 |
+
— *end example*]
|
| 94 |
+
|