summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Ferrer Ibanez <roger.ferreribanez@arm.com>2016-12-05 11:05:09 +0000
committerRoger Ferrer Ibanez <roger.ferreribanez@arm.com>2016-12-05 11:05:09 +0000
commit4cb4b36aa2537fd7115d4bf67b4d4b94cd1c0b94 (patch)
treee85a390e0451b2a10c639c174dfc5de1927f2e31
parent20b1409f35435f96cc9c1cc013ba99d8556c750d (diff)
downloadbcm5719-llvm-4cb4b36aa2537fd7115d4bf67b4d4b94cd1c0b94.tar.gz
bcm5719-llvm-4cb4b36aa2537fd7115d4bf67b4d4b94cd1c0b94.zip
Handle tests for noexcept that expect a false value
Under libcpp-no-exceptions, noexcept is trivially true. Some tests expect in the usual setting to return false, so adjust them to expect true under libcpp-no-exceptions. Differential Revision: https://reviews.llvm.org/D27310 llvm-svn: 288660
-rw-r--r--libcxx/test/libcxx/strings/iterators.exceptions.pass.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/libcxx/test/libcxx/strings/iterators.exceptions.pass.cpp b/libcxx/test/libcxx/strings/iterators.exceptions.pass.cpp
index 02ec921cc61..b236c5180b9 100644
--- a/libcxx/test/libcxx/strings/iterators.exceptions.pass.cpp
+++ b/libcxx/test/libcxx/strings/iterators.exceptions.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// <iterator>
// __libcpp_is_trivial_iterator<Tp>
@@ -26,6 +25,15 @@
#include "test_macros.h"
#include "test_iterators.h"
+#ifndef TEST_HAS_NO_EXCEPTIONS
+static const bool expected = false;
+#else
+// Under libcpp-no-exceptions all noexcept expressions are trivially true, so
+// any check for a noexcept returning false must actually check for it being
+// true.
+static const bool expected = true;
+#endif
+
int main()
{
// basic tests
@@ -43,17 +51,17 @@ int main()
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
// iterators in the libc++ test suite
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<forward_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value), "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<forward_iterator <char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value == expected, "");
#if TEST_STD_VER >= 11
static_assert(( std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
#else
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value == expected, "");
#endif
//
OpenPOWER on IntegriCloud