Boost logo

Boost :

Subject: Re: [boost] [contract] auto_..._error regression tests fail on C++1z
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2017-09-28 23:09:04


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk