52 lines
1.8 KiB
Markdown
52 lines
1.8 KiB
Markdown
[diff.cpp20.expr]
|
||
|
||
# Annex C (informative) Compatibility [[diff]](./#diff)
|
||
|
||
## C.2 C++ and ISO C++ 2020 [[diff.cpp20]](diff.cpp20#expr)
|
||
|
||
### C.2.3 [[expr]](expr "7 Expressions"): expressions [diff.cpp20.expr]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L501)
|
||
|
||
**Affected subclause:** [[expr.prim.id.unqual]](expr.prim.id.unqual)
|
||
|
||
|
||
**Change:** Change move-eligible [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1 General [expr.prim.id.general]")*s* from lvalues to xvalues[.](#1.sentence-1)
|
||
|
||
|
||
|
||
|
||
**Rationale:** Simplify the rules for implicit move[.](#1.sentence-2)
|
||
|
||
|
||
|
||
|
||
**Effect on original feature:** Valid C++ 2020 code that relies on a returned [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1 General [expr.prim.id.general]")'s
|
||
being an lvalue may change behavior or fail to compile[.](#1.sentence-3)
|
||
|
||
[*Example [1](#example-1)*: decltype(auto) f(int&& x) { return (x); } // returns int&&; previously returned int&int& g(int&& x) { return x; } // ill-formed; previously well-formed â *end example*]
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L516)
|
||
|
||
**Affected subclause:** [[expr.sub]](expr.sub)
|
||
|
||
|
||
**Change:** Change the meaning of comma in subscript expressions[.](#2.sentence-1)
|
||
|
||
|
||
|
||
|
||
**Rationale:** Enable repurposing a deprecated syntax to support multidimensional indexing[.](#2.sentence-2)
|
||
|
||
|
||
|
||
|
||
**Effect on original feature:** Valid C++ 2020 code that uses a comma expression within a
|
||
subscript expression may fail to compile[.](#2.sentence-3)
|
||
|
||
[*Example [2](#example-2)*: arr[1, 2] // was equivalent to arr[(1, 2)],// now equivalent to arr.operator[](1, 2) or ill-formed â *end example*]
|