Files
2025-10-25 03:02:53 +03:00

52 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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 "7Expressions"): 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.1General[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.1General[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*]