tmp/tmp1ejchmr_/{from.md → to.md}
RENAMED
|
@@ -2,32 +2,84 @@
|
|
| 2 |
|
| 3 |
**Change:** Only literals are integer null pointer constants.
|
| 4 |
**Rationale:** Removing surprising interactions with templates and
|
| 5 |
constant expressions. **Effect on original feature:** Valid C++03 code
|
| 6 |
may fail to compile or produce different results in this revision of
|
| 7 |
-
C++.
|
|
|
|
|
|
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
void f(void *); // #1
|
| 11 |
void f(...); // #2
|
| 12 |
template<int N> void g() {
|
| 13 |
f(0*N); // calls #2; used to call #1
|
| 14 |
}
|
| 15 |
```
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
**Change:** Specify rounding for results of integer `/` and `%`.
|
| 18 |
**Rationale:** Increase portability, C99 compatibility. **Effect on
|
| 19 |
original feature:** Valid C++03 code that uses integer division rounds
|
| 20 |
the result toward 0 or toward negative infinity, whereas this revision
|
| 21 |
of C++ always rounds the result toward 0.
|
| 22 |
|
| 23 |
**Change:** `&&` is valid in a *type-name*. **Rationale:** Required for
|
| 24 |
new features. **Effect on original feature:** Valid C++03 code may fail
|
| 25 |
-
to compile or produce different results in this revision of C++.
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
``` cpp
|
| 29 |
bool b1 = new int && false; // previously false, now ill-formed
|
| 30 |
struct S { operator int(); };
|
| 31 |
bool b2 = &S::operator int && false; // previously false, now ill-formed
|
| 32 |
```
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
**Change:** Only literals are integer null pointer constants.
|
| 4 |
**Rationale:** Removing surprising interactions with templates and
|
| 5 |
constant expressions. **Effect on original feature:** Valid C++03 code
|
| 6 |
may fail to compile or produce different results in this revision of
|
| 7 |
+
C++.
|
| 8 |
+
|
| 9 |
+
[*Example 1*:
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
void f(void *); // #1
|
| 13 |
void f(...); // #2
|
| 14 |
template<int N> void g() {
|
| 15 |
f(0*N); // calls #2; used to call #1
|
| 16 |
}
|
| 17 |
```
|
| 18 |
|
| 19 |
+
— *end example*]
|
| 20 |
+
|
| 21 |
+
**Change:** Evaluation of operands in `typeid`. **Rationale:** Introduce
|
| 22 |
+
additional expression value categories. **Effect on original feature:**
|
| 23 |
+
Valid C++03 code that uses xvalues as operands for `typeid` may change
|
| 24 |
+
behavior in this revision of C++.
|
| 25 |
+
|
| 26 |
+
[*Example 2*:
|
| 27 |
+
|
| 28 |
+
``` cpp
|
| 29 |
+
void f() {
|
| 30 |
+
struct B {
|
| 31 |
+
B() {}
|
| 32 |
+
virtual ~B() { }
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
struct C { B b; };
|
| 36 |
+
typeid(C().b); // unevaluated in C++03{}, evaluated in C++11{}
|
| 37 |
+
}
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
— *end example*]
|
| 41 |
+
|
| 42 |
**Change:** Specify rounding for results of integer `/` and `%`.
|
| 43 |
**Rationale:** Increase portability, C99 compatibility. **Effect on
|
| 44 |
original feature:** Valid C++03 code that uses integer division rounds
|
| 45 |
the result toward 0 or toward negative infinity, whereas this revision
|
| 46 |
of C++ always rounds the result toward 0.
|
| 47 |
|
| 48 |
**Change:** `&&` is valid in a *type-name*. **Rationale:** Required for
|
| 49 |
new features. **Effect on original feature:** Valid C++03 code may fail
|
| 50 |
+
to compile or produce different results in this revision of C++.
|
| 51 |
+
|
| 52 |
+
[*Example 3*:
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
bool b1 = new int && false; // previously false, now ill-formed
|
| 56 |
struct S { operator int(); };
|
| 57 |
bool b2 = &S::operator int && false; // previously false, now ill-formed
|
| 58 |
```
|
| 59 |
|
| 60 |
+
— *end example*]
|
| 61 |
+
|
| 62 |
+
**Change:** Fewer copies in the conditional operator. **Rationale:**
|
| 63 |
+
Introduce additional expression value categories. **Effect on original
|
| 64 |
+
feature:** Valid C++03 code that uses xvalues as operands for the
|
| 65 |
+
conditional operator may change behavior in this revision of C++.
|
| 66 |
+
|
| 67 |
+
[*Example 4*:
|
| 68 |
+
|
| 69 |
+
``` cpp
|
| 70 |
+
void f() {
|
| 71 |
+
struct B {
|
| 72 |
+
B() {}
|
| 73 |
+
B(const B&) { }
|
| 74 |
+
};
|
| 75 |
+
struct D : B {};
|
| 76 |
+
|
| 77 |
+
struct BB { B b; };
|
| 78 |
+
struct DD { D d; };
|
| 79 |
+
|
| 80 |
+
true ? BB().b : DD().d; // additional copy in C++03{}, no copy or move in C++11{}
|
| 81 |
+
}
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
— *end example*]
|
| 85 |
+
|