diff options
Diffstat (limited to 'libcxx/test/std/thread/futures/futures.promise/copy_assign.fail.cpp')
-rw-r--r-- | libcxx/test/std/thread/futures/futures.promise/copy_assign.fail.cpp | 82 |
1 files changed, 22 insertions, 60 deletions
diff --git a/libcxx/test/std/thread/futures/futures.promise/copy_assign.fail.cpp b/libcxx/test/std/thread/futures/futures.promise/copy_assign.fail.cpp index c0827812222..e150ba0df65 100644 --- a/libcxx/test/std/thread/futures/futures.promise/copy_assign.fail.cpp +++ b/libcxx/test/std/thread/futures/futures.promise/copy_assign.fail.cpp @@ -14,74 +14,36 @@ // promise& operator=(const promise& rhs) = delete; #include <future> -#include <cassert> -#include "../test_allocator.h" +#include "test_macros.h" int main() { - assert(test_alloc_base::count == 0); +#if TEST_STD_VER >= 11 { - std::promise<int> p0(std::allocator_arg, test_allocator<int>()); - std::promise<int> p(std::allocator_arg, test_allocator<int>()); - assert(test_alloc_base::count == 2); - p = p0; - assert(test_alloc_base::count == 1); - std::future<int> f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); + std::promise<int> p0, p; + p = p0; // expected-error {{overload resolution selected deleted operator '='}} } - assert(test_alloc_base::count == 0); { - std::promise<int&> p0(std::allocator_arg, test_allocator<int>()); - std::promise<int&> p(std::allocator_arg, test_allocator<int>()); - assert(test_alloc_base::count == 2); - p = p0; - assert(test_alloc_base::count == 1); - std::future<int&> f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); + std::promise<int&> p0, p; + p = p0; // expected-error {{overload resolution selected deleted operator '='}} } - assert(test_alloc_base::count == 0); { - std::promise<void> p0(std::allocator_arg, test_allocator<void>()); - std::promise<void> p(std::allocator_arg, test_allocator<void>()); - assert(test_alloc_base::count == 2); - p = p0; - assert(test_alloc_base::count == 1); - std::future<void> f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); + std::promise<void> p0, p; + p = p0; // expected-error {{overload resolution selected deleted operator '='}} } - assert(test_alloc_base::count == 0); +#else + { + std::promise<int> p0, p; + p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int>'}} + } + { + std::promise<int&> p0, p; + p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int &>'}} + } + { + std::promise<void> p0, p; + p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<void>'}} + } +#endif } |