tmp/tmpea7wdnpg/{from.md → to.md}
RENAMED
|
@@ -5,12 +5,12 @@ second or third operand keeps the type and value category of the other
|
|
| 5 |
operand. **Rationale:** Formerly mandated conversions (lvalue-to-rvalue
|
| 6 |
[[conv.lval]], array-to-pointer [[conv.array]], and function-to-pointer
|
| 7 |
[[conv.func]] standard conversions), especially the creation of the
|
| 8 |
temporary due to lvalue-to-rvalue conversion, were considered gratuitous
|
| 9 |
and surprising. **Effect on original feature:** Valid C++11 code that
|
| 10 |
-
relies on the conversions may behave differently in this
|
| 11 |
-
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
struct S {
|
| 15 |
int x = 1;
|
| 16 |
void mf() { x = 2; }
|
|
@@ -20,15 +20,15 @@ int f(bool cond) {
|
|
| 20 |
(cond ? s : throw 0).mf();
|
| 21 |
return s.x;
|
| 22 |
}
|
| 23 |
```
|
| 24 |
|
| 25 |
-
In C++11, `f(true)` returns `1`. In this
|
| 26 |
-
|
| 27 |
|
| 28 |
``` cpp
|
| 29 |
sizeof(true ? "" : throw 0)
|
| 30 |
```
|
| 31 |
|
| 32 |
-
In C++11, the expression yields `sizeof(const char*)`. In this
|
| 33 |
-
|
| 34 |
|
|
|
|
| 5 |
operand. **Rationale:** Formerly mandated conversions (lvalue-to-rvalue
|
| 6 |
[[conv.lval]], array-to-pointer [[conv.array]], and function-to-pointer
|
| 7 |
[[conv.func]] standard conversions), especially the creation of the
|
| 8 |
temporary due to lvalue-to-rvalue conversion, were considered gratuitous
|
| 9 |
and surprising. **Effect on original feature:** Valid C++11 code that
|
| 10 |
+
relies on the conversions may behave differently in this revision of
|
| 11 |
+
C++. For example:
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
struct S {
|
| 15 |
int x = 1;
|
| 16 |
void mf() { x = 2; }
|
|
|
|
| 20 |
(cond ? s : throw 0).mf();
|
| 21 |
return s.x;
|
| 22 |
}
|
| 23 |
```
|
| 24 |
|
| 25 |
+
In C++11, `f(true)` returns `1`. In this revision of C++, it returns
|
| 26 |
+
`2`.
|
| 27 |
|
| 28 |
``` cpp
|
| 29 |
sizeof(true ? "" : throw 0)
|
| 30 |
```
|
| 31 |
|
| 32 |
+
In C++11, the expression yields `sizeof(const char*)`. In this revision
|
| 33 |
+
of C++, it yields `sizeof(const char[1])`.
|
| 34 |
|