Protect futures test under libcpp-no-exceptions

Skip tests that expect an exception be thrown.

Differential Revision: https://reviews.llvm.org/D27253

llvm-svn: 288382
This commit is contained in:
Roger Ferrer Ibanez 2016-12-01 17:34:57 +00:00
parent 4ddb8c01b1
commit f3fce920ff
1 changed files with 7 additions and 1 deletions

View File

@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@ -20,6 +19,7 @@
#include <future>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
int main()
@ -34,6 +34,7 @@ int main()
std::future<int> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@ -43,6 +44,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
#endif
assert(test_alloc_base::alloc_count == 1);
}
assert(test_alloc_base::alloc_count == 0);
@ -55,6 +57,7 @@ int main()
std::future<int&> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@ -64,6 +67,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
#endif
assert(test_alloc_base::alloc_count == 1);
}
assert(test_alloc_base::alloc_count == 0);
@ -76,6 +80,7 @@ int main()
std::future<void> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@ -85,6 +90,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
#endif
assert(test_alloc_base::alloc_count == 1);
}
assert(test_alloc_base::alloc_count == 0);