tmp/tmpk2u_i6sh/{from.md → to.md}
RENAMED
|
@@ -1,17 +1,36 @@
|
|
| 1 |
-
###
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
struct S {
|
| 13 |
constexpr const int &f();
|
| 14 |
int &f();
|
| 15 |
};
|
| 16 |
```
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 International Standard. For
|
| 7 |
+
example, the following code is valid in C++11 but invalid in this
|
| 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 International
|
| 22 |
+
Standard. For example:
|
| 23 |
+
|
| 24 |
+
``` cpp
|
| 25 |
+
struct S { // Aggregate in C++14{} onwards.
|
| 26 |
+
int m = 1;
|
| 27 |
+
};
|
| 28 |
+
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 International Standard
|
| 35 |
+
```
|
| 36 |
+
|