From 1df02ee1f989139c4fcfb47009ce4d62e2ca5146 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 19 Aug 2015 04:10:15 +0000 Subject: Mark std::packaged_task tests as unsupported in C++03. std::packaged_task requires variadic templates and is #ifdef out in C++03. This patch silences the tests in C++03. This patch also rewrites the .fail.cpp tests so that they use clang verify. llvm-svn: 245413 --- .../futures.task.members/assign_copy.fail.cpp | 30 +++------------------- .../futures.task.members/assign_move.pass.cpp | 1 + .../futures.task.members/ctor1.fail.cpp | 5 +++- .../futures.task.members/ctor2.fail.cpp | 7 +++-- .../futures.task.members/ctor_copy.fail.cpp | 25 +++--------------- .../futures.task.members/ctor_default.pass.cpp | 1 + .../futures.task.members/ctor_func.pass.cpp | 1 + .../futures.task.members/ctor_func_alloc.pass.cpp | 19 +++++++------- .../futures.task.members/ctor_move.pass.cpp | 1 + .../futures.tas/futures.task.members/dtor.pass.cpp | 1 + .../futures.task.members/get_future.pass.cpp | 1 + .../make_ready_at_thread_exit.pass.cpp | 1 + .../futures.task.members/operator.pass.cpp | 1 + .../futures.task.members/reset.pass.cpp | 1 + .../futures.tas/futures.task.members/swap.pass.cpp | 1 + .../futures.task.nonmembers/swap.pass.cpp | 1 + .../uses_allocator.pass.cpp | 8 +++++- .../std/thread/futures/futures.tas/types.pass.cpp | 1 + 18 files changed, 45 insertions(+), 61 deletions(-) (limited to 'libcxx/test/std/thread') diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp index 70ea0ad31fe..6c6418594d0 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class packaged_task @@ -14,35 +16,11 @@ // packaged_task& operator=(packaged_task&) = delete; #include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; int main() { { - std::packaged_task p0(A(5)); - std::packaged_task p; - p = p0; - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p0; - std::packaged_task p; - p = p0; - assert(!p0.valid()); - assert(!p.valid()); + std::packaged_task p0, p; + p = p0; // expected-error {{overload resolution selected deleted operator '='}} } } diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp index 18786f4eb7a..3f11d670bed 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp index 45048b747f7..7097d428962 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class packaged_task @@ -25,5 +27,6 @@ typedef volatile std::packaged_task VPT; int main() { - PT p { VPT{} }; + PT p { VPT{} }; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task')}} + // expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}} } diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp index e4df4ec225e..feb7657bed3 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class packaged_task @@ -18,7 +20,7 @@ #include #include -#include "../../test_allocator.h" +#include "test_allocator.h" struct A {}; typedef std::packaged_task PT; @@ -26,5 +28,6 @@ typedef volatile std::packaged_task VPT; int main() { - PT p { std::allocator_arg_t{}, test_allocator{}, VPT {}}; + PT p { std::allocator_arg_t{}, test_allocator{}, VPT {}}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task')}} + // expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}} } diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp index 9884c49a6dc..97624f90f3d 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class packaged_task @@ -14,33 +16,12 @@ // packaged_task(packaged_task&) = delete; #include -#include - -class A -{ - long data_; -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; int main() { - { - std::packaged_task p0(A(5)); - std::packaged_task p(p0); - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } { std::packaged_task p0; - std::packaged_task p(p0); - assert(!p0.valid()); - assert(!p.valid()); + std::packaged_task p(p0); // expected-error {{call to deleted constructor of 'std::packaged_task'}} } } diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp index 76904962a77..ed147d74895 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp index 2eee2cbc2d5..14ac7614bb8 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp index 3aac2b26bfc..39784876b8c 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // @@ -19,7 +20,7 @@ #include #include -#include "../../test_allocator.h" +#include "test_allocator.h" #include "min_allocator.h" class A @@ -47,7 +48,7 @@ int main() { std::packaged_task p(std::allocator_arg, test_allocator(), A(5)); - assert(test_alloc_base::count > 0); + assert(test_alloc_base::alloc_count > 0); assert(p.valid()); std::future f = p.get_future(); p(3, 'a'); @@ -55,14 +56,14 @@ int main() assert(A::n_copies == 0); assert(A::n_moves > 0); } - assert(test_alloc_base::count == 0); + assert(test_alloc_base::alloc_count == 0); A::n_copies = 0; A::n_moves = 0; { A a(5); std::packaged_task p(std::allocator_arg, test_allocator(), a); - assert(test_alloc_base::count > 0); + assert(test_alloc_base::alloc_count > 0); assert(p.valid()); std::future f = p.get_future(); p(3, 'a'); @@ -70,31 +71,31 @@ int main() assert(A::n_copies > 0); assert(A::n_moves > 0); } - assert(test_alloc_base::count == 0); + assert(test_alloc_base::alloc_count == 0); A::n_copies = 0; A::n_moves = 0; { A a(5); std::packaged_task p(std::allocator_arg, test_allocator(), &func); - assert(test_alloc_base::count > 0); + assert(test_alloc_base::alloc_count > 0); assert(p.valid()); std::future f = p.get_future(); p(4); assert(f.get() == 4); } - assert(test_alloc_base::count == 0); + assert(test_alloc_base::alloc_count == 0); A::n_copies = 0; A::n_moves = 0; { A a(5); std::packaged_task p(std::allocator_arg, test_allocator(), func); - assert(test_alloc_base::count > 0); + assert(test_alloc_base::alloc_count > 0); assert(p.valid()); std::future f = p.get_future(); p(4); assert(f.get() == 4); } - assert(test_alloc_base::count == 0); + assert(test_alloc_base::alloc_count == 0); A::n_copies = 0; A::n_moves = 0; { diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp index 88f07228175..d9951dca585 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp index e24232d1b22..afaf0a55f91 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp index 13b5db11066..d0e060d8c71 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp index 61a6a4f8796..57879559ac2 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp index 2a09353b1e6..4a6d3c75917 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp index 9d38d9b409c..924188b27aa 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp index 33763bef0d0..eb0091c8e81 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp index 668732b9b24..d90d593a75b 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // diff --git a/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp index 986f71e29a4..bbe75de7f8a 100644 --- a/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp @@ -9,6 +9,12 @@ // // UNSUPPORTED: libcpp-has-no-threads +// This test is marked XFAIL and not UNSUPPORTED because the non-variadic +// declaration of packaged_task is available in C++03. Therefore the test +// should fail because the static_assert fires and not because std::packaged_task +// in undefined. +// XFAIL: c++98, c++03 + // // class packaged_task @@ -18,7 +24,7 @@ // : true_type { }; #include -#include "../../test_allocator.h" +#include "test_allocator.h" int main() { diff --git a/libcxx/test/std/thread/futures/futures.tas/types.pass.cpp b/libcxx/test/std/thread/futures/futures.tas/types.pass.cpp index dd1724ddbda..f7c9b223add 100644 --- a/libcxx/test/std/thread/futures/futures.tas/types.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.tas/types.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 // -- cgit v1.2.3