From 1d4a1edbc7e4461b59239e1b8297e9dd395a6322 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 25 May 2016 22:36:09 -0700 Subject: Revert "Update aosp/master libcxx rebase to r263688" The world is burning. This reverts commit c004fd909c006eec55077c52ee119e1fa338c9e9, reversing changes made to 1418e4163da4bb0b9e3fe496e51c23a0dce399d9. --- .../futures/futures.promise/copy_ctor.fail.cpp | 78 +++++++++++++++------- 1 file changed, 54 insertions(+), 24 deletions(-) (limited to 'test/std/thread/futures/futures.promise/copy_ctor.fail.cpp') diff --git a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp index 779fc5bfc..36a3555ae 100644 --- a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp +++ b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp @@ -6,8 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// UNSUPPORTED: libcpp-has-no-threads // @@ -16,36 +14,68 @@ // promise(const promise&) = delete; #include +#include -#include "test_macros.h" +#include "../test_allocator.h" int main() { -#if TEST_STD_VER >= 11 - { - std::promise p0; - std::promise p(p0); // expected-error {{call to deleted constructor of 'std::promise'}} - } - { - std::promise p0; - std::promise p(p0); // expected-error {{call to deleted constructor of 'std::promise'}} - } - { - std::promise p0; - std::promise p(p0); // expected-error {{call to deleted constructor of 'std::promise'}} - } -#else + assert(test_alloc_base::count == 0); { - std::promise p0; - std::promise p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise'}} + std::promise p0(std::allocator_arg, test_allocator()); + std::promise p(p0); + assert(test_alloc_base::count == 1); + std::future 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); } + assert(test_alloc_base::count == 0); { - std::promise p0; - std::promise p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise'}} + std::promise p0(std::allocator_arg, test_allocator()); + std::promise p(p0); + assert(test_alloc_base::count == 1); + std::future 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); } + assert(test_alloc_base::count == 0); { - std::promise p0; - std::promise p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise'}} + std::promise p0(std::allocator_arg, test_allocator()); + std::promise p(p0); + assert(test_alloc_base::count == 1); + std::future 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); } -#endif + assert(test_alloc_base::count == 0); } -- cgit v1.2.3