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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245413 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8dca5f978
commit
faa9a31aef
@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
// class packaged_task<R(ArgTypes...)>
|
||||
@ -14,35 +16,11 @@
|
||||
// packaged_task& operator=(packaged_task&) = delete;
|
||||
|
||||
#include <future>
|
||||
#include <cassert>
|
||||
|
||||
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<double(int, char)> p0(A(5));
|
||||
std::packaged_task<double(int, char)> p;
|
||||
p = p0;
|
||||
assert(!p0.valid());
|
||||
assert(p.valid());
|
||||
std::future<double> f = p.get_future();
|
||||
p(3, 'a');
|
||||
assert(f.get() == 105.0);
|
||||
}
|
||||
{
|
||||
std::packaged_task<double(int, char)> p0;
|
||||
std::packaged_task<double(int, char)> p;
|
||||
p = p0;
|
||||
assert(!p0.valid());
|
||||
assert(!p.valid());
|
||||
std::packaged_task<double(int, char)> p0, p;
|
||||
p = p0; // expected-error {{overload resolution selected deleted operator '='}}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
// class packaged_task<R(ArgTypes...)>
|
||||
@ -25,5 +27,6 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
|
||||
|
||||
int main()
|
||||
{
|
||||
PT p { VPT{} };
|
||||
PT p { VPT{} }; // 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'}}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
// class packaged_task<R(ArgTypes...)>
|
||||
@ -18,7 +20,7 @@
|
||||
#include <future>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../test_allocator.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
struct A {};
|
||||
typedef std::packaged_task<A(int, char)> PT;
|
||||
@ -26,5 +28,6 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
|
||||
|
||||
int main()
|
||||
{
|
||||
PT p { std::allocator_arg_t{}, test_allocator<A>{}, VPT {}};
|
||||
PT p { std::allocator_arg_t{}, test_allocator<A>{}, VPT {}}; // 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'}}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
// class packaged_task<R(ArgTypes...)>
|
||||
@ -14,33 +16,12 @@
|
||||
// packaged_task(packaged_task&) = delete;
|
||||
|
||||
#include <future>
|
||||
#include <cassert>
|
||||
|
||||
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<double(int, char)> p0(A(5));
|
||||
std::packaged_task<double(int, char)> p(p0);
|
||||
assert(!p0.valid());
|
||||
assert(p.valid());
|
||||
std::future<double> f = p.get_future();
|
||||
p(3, 'a');
|
||||
assert(f.get() == 105.0);
|
||||
}
|
||||
{
|
||||
std::packaged_task<double(int, char)> p0;
|
||||
std::packaged_task<double(int, char)> p(p0);
|
||||
assert(!p0.valid());
|
||||
assert(!p.valid());
|
||||
std::packaged_task<double(int, char)> p(p0); // expected-error {{call to deleted constructor of 'std::packaged_task<double (int, char)>'}}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
@ -19,7 +20,7 @@
|
||||
#include <future>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../test_allocator.h"
|
||||
#include "test_allocator.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
class A
|
||||
@ -47,7 +48,7 @@ int main()
|
||||
{
|
||||
std::packaged_task<double(int, char)> p(std::allocator_arg,
|
||||
test_allocator<A>(), A(5));
|
||||
assert(test_alloc_base::count > 0);
|
||||
assert(test_alloc_base::alloc_count > 0);
|
||||
assert(p.valid());
|
||||
std::future<double> 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<double(int, char)> p(std::allocator_arg,
|
||||
test_allocator<A>(), a);
|
||||
assert(test_alloc_base::count > 0);
|
||||
assert(test_alloc_base::alloc_count > 0);
|
||||
assert(p.valid());
|
||||
std::future<double> 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<int(int)> p(std::allocator_arg, test_allocator<A>(), &func);
|
||||
assert(test_alloc_base::count > 0);
|
||||
assert(test_alloc_base::alloc_count > 0);
|
||||
assert(p.valid());
|
||||
std::future<int> 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<int(int)> p(std::allocator_arg, test_allocator<A>(), func);
|
||||
assert(test_alloc_base::count > 0);
|
||||
assert(test_alloc_base::alloc_count > 0);
|
||||
assert(p.valid());
|
||||
std::future<int> 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;
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
@ -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
|
||||
|
||||
// <future>
|
||||
|
||||
// class packaged_task<R(ArgTypes...)>
|
||||
@ -18,7 +24,7 @@
|
||||
// : true_type { };
|
||||
|
||||
#include <future>
|
||||
#include "../../test_allocator.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <future>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user