28 Sep
2017
28 Sep
'17
11:09 p.m.
AMDG On 09/28/2017 04:58 PM, Lorenzo Caminiti via Boost wrote:
<snip>
Correctly it does not compile up to C++1y because main cannot access the copy operations:
$ clang++ -std=c++1y 05.cpp 05.cpp:14:15: error: calling a private constructor of class 'x' auto xx = f(); ^ 05.cpp:5:5: note: declared private here x(x const&) {} ^ 1 error generated.
However, it compiles on C++1z?!
$ clang++ -std=c++1z 05.cpp # Not compiler errors?!
Why... what changed in C++1z that makes the above compile? How can I prevent copying x outside its friend function f in C++1z?
This code no longer makes a copy, and does not require the copy constructor. In Christ, Steven Watanabe