Avoid C++17 guaranteed copy elision when testing for non-copyability
authorEric Fiselier <eric@efcs.ca>
Thu, 8 Dec 2016 09:57:00 +0000 (09:57 +0000)
committerEric Fiselier <eric@efcs.ca>
Thu, 8 Dec 2016 09:57:00 +0000 (09:57 +0000)
llvm-svn: 289033

libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp

index 469c744..03f6d7d 100644 (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}}
 }
index 6d7d734..8882fd1 100644 (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'}}
 }