79479250

Date: 2025-03-02 14:42:45
Score: 1.5
Natty:
Report link

Answered in comments by @cpplearner:

Guaranteed copy/move ellision which allows the code to work even if the copy/move is explicitly or implicitly deleted was added in C++17[1]

Issue is not about compilers, but by the their default C++ versions. MSVC -std=c++14 and GCC/clang -std=c++14 all fail to compile, while for c++17 they all work, as expected.

[1](https://en.cppreference.com/w/cpp/language/copy_elision#:~:text=Prvalue%20semantics%20(%22guaranteed%20copy%20elision%22)

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @cpplearner
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Dominik Kaszewski