Avoid C++17 guaranteed copy elision when testing for non-copyability

llvm-svn: 289033
This commit is contained in:
Eric Fiselier 2016-12-08 09:57:00 +00:00
parent cd9d374337
commit 009259da8a
2 changed files with 4 additions and 3 deletions

View File

@ -17,9 +17,9 @@
#include <streambuf>
#include <cassert>
std::streambuf get();
std::streambuf &get();
int main()
{
std::streambuf sb = get();
std::streambuf sb = get(); // expected-error {{calling a protected constructor}}
}

View File

@ -28,6 +28,7 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
int main()
{
PT p { VPT{} }; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
VPT init{};
PT p{init}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
// expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}}
}