mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
Protect std::experimental::optional tests under libcpp-no-exceptions
In these tests there are some paths that explicitly throw, so use the TEST_THROW macro that was proposed for this and then skip the tests that may enter the throwing path. Differential Revision: https://reviews.llvm.org/D26142 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286099 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
// XFAIL: libcpp-no-exceptions
|
||||
// <optional>
|
||||
|
||||
// T& optional<T>::value();
|
||||
@@ -17,6 +16,8 @@
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
using std::experimental::optional;
|
||||
using std::experimental::bad_optional_access;
|
||||
|
||||
@@ -35,6 +36,7 @@ int main()
|
||||
opt.emplace();
|
||||
assert(opt.value().test() == 4);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
{
|
||||
optional<X> opt;
|
||||
try
|
||||
@@ -46,4 +48,5 @@ int main()
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user