tmp/tmpm9ykrm6h/{from.md → to.md}
RENAMED
|
@@ -1,27 +1,28 @@
|
|
| 1 |
### [[dcl.dcl]]: declarations <a id="diff.cpp11.dcl.dcl">[[diff.cpp11.dcl.dcl]]</a>
|
| 2 |
|
| 3 |
**Change:** `constexpr` non-static member functions are not implicitly
|
| 4 |
`const` member functions. **Rationale:** Necessary to allow `constexpr`
|
| 5 |
member functions to mutate the object. **Effect on original feature:**
|
| 6 |
-
Valid C++11 code may fail to compile in this
|
| 7 |
-
example
|
| 8 |
-
International Standard because it declares the same member function
|
| 9 |
-
twice with different return types:
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
struct S {
|
| 13 |
constexpr const int &f();
|
| 14 |
int &f();
|
| 15 |
};
|
| 16 |
```
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
**Change:** Classes with default member initializers can be aggregates.
|
| 19 |
**Rationale:** Necessary to allow default member initializers to be used
|
| 20 |
by aggregate initialization. **Effect on original feature:** Valid C++11
|
| 21 |
-
code may fail to compile or may change meaning in this
|
| 22 |
-
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
struct S { // Aggregate in C++14{} onwards.
|
| 26 |
int m = 1;
|
| 27 |
};
|
|
@@ -29,8 +30,8 @@ struct X {
|
|
| 29 |
operator int();
|
| 30 |
operator S();
|
| 31 |
};
|
| 32 |
X a{};
|
| 33 |
S b{a}; // uses copy constructor in C++11{},
|
| 34 |
-
// performs aggregate initialization in this
|
| 35 |
```
|
| 36 |
|
|
|
|
| 1 |
### [[dcl.dcl]]: declarations <a id="diff.cpp11.dcl.dcl">[[diff.cpp11.dcl.dcl]]</a>
|
| 2 |
|
| 3 |
**Change:** `constexpr` non-static member functions are not implicitly
|
| 4 |
`const` member functions. **Rationale:** Necessary to allow `constexpr`
|
| 5 |
member functions to mutate the object. **Effect on original feature:**
|
| 6 |
+
Valid C++11 code may fail to compile in this revision of C++. For
|
| 7 |
+
example:
|
|
|
|
|
|
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
struct S {
|
| 11 |
constexpr const int &f();
|
| 12 |
int &f();
|
| 13 |
};
|
| 14 |
```
|
| 15 |
|
| 16 |
+
This code is valid in C++11 but invalid in this revision of C++ because
|
| 17 |
+
it declares the same member function twice with different return types.
|
| 18 |
+
|
| 19 |
**Change:** Classes with default member initializers can be aggregates.
|
| 20 |
**Rationale:** Necessary to allow default member initializers to be used
|
| 21 |
by aggregate initialization. **Effect on original feature:** Valid C++11
|
| 22 |
+
code may fail to compile or may change meaning in this revision of C++.
|
| 23 |
+
For example:
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
struct S { // Aggregate in C++14{} onwards.
|
| 27 |
int m = 1;
|
| 28 |
};
|
|
|
|
| 30 |
operator int();
|
| 31 |
operator S();
|
| 32 |
};
|
| 33 |
X a{};
|
| 34 |
S b{a}; // uses copy constructor in C++11{},
|
| 35 |
+
// performs aggregate initialization in this revision of C++{}
|
| 36 |
```
|
| 37 |
|