Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1280

Answer by HolyBlackCat for g++ ok but clang no: return rvalue to lvalue

$
0
0

This is legal since C++23, see P2266R3. GCC 13+ and Clang 13+both implement it (both accept your code in C++23 mode), while MSVC doesn't yet.

This paper (among other things) extends the implicit move (that happens when returning a local variable that's either not a reference or an rvalue reference) to apply regardless of the return type, while it used to only work when returning non-references.


Viewing all articles
Browse latest Browse all 1280

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>