tmp/tmprh5sxys1/{from.md → to.md}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
-
### [[dcl
|
| 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++.
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
struct S {
|
| 11 |
constexpr const int &f();
|
| 12 |
int &f();
|
|
@@ -14,15 +15,18 @@ struct S {
|
|
| 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 |
-
|
|
|
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
struct S { // Aggregate in C++14{} onwards.
|
| 27 |
int m = 1;
|
| 28 |
};
|
|
@@ -33,5 +37,7 @@ struct X {
|
|
| 33 |
X a{};
|
| 34 |
S b{a}; // uses copy constructor in C++11{},
|
| 35 |
// performs aggregate initialization in this revision of C++{}
|
| 36 |
```
|
| 37 |
|
|
|
|
|
|
|
|
|
| 1 |
+
### [[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++.
|
| 7 |
+
|
| 8 |
+
[*Example 1*:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
struct S {
|
| 12 |
constexpr const int &f();
|
| 13 |
int &f();
|
|
|
|
| 15 |
```
|
| 16 |
|
| 17 |
This code is valid in C++11 but invalid in this revision of C++ because
|
| 18 |
it declares the same member function twice with different return types.
|
| 19 |
|
| 20 |
+
— *end example*]
|
| 21 |
+
|
| 22 |
**Change:** Classes with default member initializers can be aggregates.
|
| 23 |
**Rationale:** Necessary to allow default member initializers to be used
|
| 24 |
by aggregate initialization. **Effect on original feature:** Valid C++11
|
| 25 |
code may fail to compile or may change meaning in this revision of C++.
|
| 26 |
+
|
| 27 |
+
[*Example 2*:
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
struct S { // Aggregate in C++14{} onwards.
|
| 31 |
int m = 1;
|
| 32 |
};
|
|
|
|
| 37 |
X a{};
|
| 38 |
S b{a}; // uses copy constructor in C++11{},
|
| 39 |
// performs aggregate initialization in this revision of C++{}
|
| 40 |
```
|
| 41 |
|
| 42 |
+
— *end example*]
|
| 43 |
+
|