tmp/tmp3gpuqqf4/{from.md → to.md}
RENAMED
|
@@ -4,42 +4,51 @@
|
|
| 4 |
immediately after an `explicit` *decl-specifier* in a constructor
|
| 5 |
declaration. The *conversion-function-id* can no longer be used
|
| 6 |
parenthesized immediately after an `explicit` *decl-specifier* in a
|
| 7 |
conversion function declaration. **Rationale:** Necessary for new
|
| 8 |
functionality. **Effect on original feature:** Valid C++17 code may fail
|
| 9 |
-
to compile in this revision of C++.
|
|
|
|
|
|
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
struct S {
|
| 13 |
explicit (S)(const S&); // ill-formed; previously well-formed
|
| 14 |
explicit (operator int)(); // ill-formed; previously well-formed
|
| 15 |
explicit(true) (S)(int); // OK
|
| 16 |
};
|
| 17 |
```
|
| 18 |
|
|
|
|
|
|
|
| 19 |
**Change:** A *simple-template-id* is no longer valid as the
|
| 20 |
*declarator-id* of a constructor or destructor. **Rationale:** Remove
|
| 21 |
potentially error-prone option for redundancy. **Effect on original
|
| 22 |
feature:** Valid C++17 code may fail to compile in this revision of C++.
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
template<class T>
|
| 27 |
struct A {
|
| 28 |
A<T>(); // error: simple-template-id not allowed for constructor
|
| 29 |
A(int); // OK, injected-class-name used
|
| 30 |
~A<T>(); // error: simple-template-id not allowed for destructor
|
| 31 |
};
|
| 32 |
```
|
| 33 |
|
|
|
|
|
|
|
| 34 |
**Change:** A function returning an implicitly movable entity may invoke
|
| 35 |
a constructor taking an rvalue reference to a type different from that
|
| 36 |
of the returned expression. Function and catch-clause parameters can be
|
| 37 |
thrown using move constructors. **Rationale:** Side effect of making it
|
| 38 |
easier to write more efficient code that takes advantage of moves.
|
| 39 |
**Effect on original feature:** Valid C++17 code may fail to compile or
|
| 40 |
-
have different semantics in this revision of C++.
|
|
|
|
|
|
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
struct base {
|
| 44 |
base();
|
| 45 |
base(base const &);
|
|
@@ -69,5 +78,7 @@ void g() {
|
|
| 69 |
consume(static_cast<S&&>(s));
|
| 70 |
char c = *s.m; // undefined behavior; previously ok
|
| 71 |
}
|
| 72 |
```
|
| 73 |
|
|
|
|
|
|
|
|
|
| 4 |
immediately after an `explicit` *decl-specifier* in a constructor
|
| 5 |
declaration. The *conversion-function-id* can no longer be used
|
| 6 |
parenthesized immediately after an `explicit` *decl-specifier* in a
|
| 7 |
conversion function declaration. **Rationale:** Necessary for new
|
| 8 |
functionality. **Effect on original feature:** Valid C++17 code may fail
|
| 9 |
+
to compile in this revision of C++.
|
| 10 |
+
|
| 11 |
+
[*Example 1*:
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
struct S {
|
| 15 |
explicit (S)(const S&); // ill-formed; previously well-formed
|
| 16 |
explicit (operator int)(); // ill-formed; previously well-formed
|
| 17 |
explicit(true) (S)(int); // OK
|
| 18 |
};
|
| 19 |
```
|
| 20 |
|
| 21 |
+
— *end example*]
|
| 22 |
+
|
| 23 |
**Change:** A *simple-template-id* is no longer valid as the
|
| 24 |
*declarator-id* of a constructor or destructor. **Rationale:** Remove
|
| 25 |
potentially error-prone option for redundancy. **Effect on original
|
| 26 |
feature:** Valid C++17 code may fail to compile in this revision of C++.
|
| 27 |
+
|
| 28 |
+
[*Example 2*:
|
| 29 |
|
| 30 |
``` cpp
|
| 31 |
template<class T>
|
| 32 |
struct A {
|
| 33 |
A<T>(); // error: simple-template-id not allowed for constructor
|
| 34 |
A(int); // OK, injected-class-name used
|
| 35 |
~A<T>(); // error: simple-template-id not allowed for destructor
|
| 36 |
};
|
| 37 |
```
|
| 38 |
|
| 39 |
+
— *end example*]
|
| 40 |
+
|
| 41 |
**Change:** A function returning an implicitly movable entity may invoke
|
| 42 |
a constructor taking an rvalue reference to a type different from that
|
| 43 |
of the returned expression. Function and catch-clause parameters can be
|
| 44 |
thrown using move constructors. **Rationale:** Side effect of making it
|
| 45 |
easier to write more efficient code that takes advantage of moves.
|
| 46 |
**Effect on original feature:** Valid C++17 code may fail to compile or
|
| 47 |
+
have different semantics in this revision of C++.
|
| 48 |
+
|
| 49 |
+
[*Example 3*:
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
struct base {
|
| 53 |
base();
|
| 54 |
base(base const &);
|
|
|
|
| 78 |
consume(static_cast<S&&>(s));
|
| 79 |
char c = *s.m; // undefined behavior; previously ok
|
| 80 |
}
|
| 81 |
```
|
| 82 |
|
| 83 |
+
— *end example*]
|
| 84 |
+
|