tmp/tmp06zg9a7g/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### [[dcl.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 International Standard.
|
| 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 International Standard, with no diagnostic required.
|
| 18 |
+
|
| 19 |
+
``` cpp
|
| 20 |
+
// Translation unit 1
|
| 21 |
+
int f(int a = 42);
|
| 22 |
+
int g() { return f(); }
|
| 23 |
+
|
| 24 |
+
// Translation unit 2
|
| 25 |
+
int f(int a = 76) { return a; } // ill-formed, no diagnostic required; previously well-formed
|
| 26 |
+
int g();
|
| 27 |
+
int main() { return g(); } // used to return 42
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
**Change:** A class that has user-declared constructors is never an
|
| 31 |
+
aggregate. **Rationale:** Remove potentially error-prone aggregate
|
| 32 |
+
initialization which may apply notwithstanding the declared constructors
|
| 33 |
+
of a class. **Effect on original feature:** Valid C++17 code that
|
| 34 |
+
aggregate-initializes a type with a user-declared constructor may be
|
| 35 |
+
ill-formed or have different semantics in this International Standard.
|
| 36 |
+
|
| 37 |
+
``` cpp
|
| 38 |
+
struct A { // not an aggregate; previously an aggregate
|
| 39 |
+
A() = delete;
|
| 40 |
+
};
|
| 41 |
+
|
| 42 |
+
struct B { // not an aggregate; previously an aggregate
|
| 43 |
+
B() = default;
|
| 44 |
+
int i = 0;
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
struct C { // not an aggregate; previously an aggregate
|
| 48 |
+
C(C&&) = default;
|
| 49 |
+
int a, b;
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
A a{}; // ill-formed; previously well-formed
|
| 53 |
+
B b = {1}; // ill-formed; previously well-formed
|
| 54 |
+
auto* c = new C{2, 3}; // ill-formed; previously well-formed
|
| 55 |
+
|
| 56 |
+
struct Y;
|
| 57 |
+
|
| 58 |
+
struct X {
|
| 59 |
+
operator Y();
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
struct Y { // not an aggregate; previously an aggregate
|
| 63 |
+
Y(const Y&) = default;
|
| 64 |
+
X x;
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
Y y{X{}}; // copy constructor call; previously aggregate-initialization
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
**Change:** Boolean conversion from a pointer or pointer-to-member type
|
| 71 |
+
is now a narrowing conversion. **Rationale:** Catches bugs. **Effect on
|
| 72 |
+
original feature:** Valid C++17 code may fail to compile in this
|
| 73 |
+
International Standard. For example:
|
| 74 |
+
|
| 75 |
+
``` cpp
|
| 76 |
+
bool y[] = { "bc" }; // ill-formed; previously well-formed
|
| 77 |
+
```
|
| 78 |
+
|