tmp/tmpbsnos_t9/{from.md → to.md}
RENAMED
|
@@ -1,22 +1,23 @@
|
|
| 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
|
| 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
|
|
|
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
// Translation unit 1
|
| 21 |
int f(int a = 42);
|
| 22 |
int g() { return f(); }
|
|
@@ -30,11 +31,12 @@ int main() { return g(); } // used to return 42
|
|
| 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
|
|
|
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
struct A { // not an aggregate; previously an aggregate
|
| 39 |
A() = delete;
|
| 40 |
};
|
|
@@ -68,11 +70,11 @@ Y y{X{}}; // copy constructor call; previously aggregate-initializ
|
|
| 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 |
-
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
bool y[] = { "bc" }; // ill-formed; previously well-formed
|
| 77 |
```
|
| 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 revision of C++. For example:
|
| 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. For
|
| 18 |
+
example:
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
// Translation unit 1
|
| 22 |
int f(int a = 42);
|
| 23 |
int g() { return f(); }
|
|
|
|
| 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++. For
|
| 37 |
+
example:
|
| 38 |
|
| 39 |
``` cpp
|
| 40 |
struct A { // not an aggregate; previously an aggregate
|
| 41 |
A() = delete;
|
| 42 |
};
|
|
|
|
| 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++. For example:
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
bool y[] = { "bc" }; // ill-formed; previously well-formed
|
| 79 |
```
|
| 80 |
|