From d59e3c7fed9486c11683fa1192fb004f0a88da42 Mon Sep 17 00:00:00 2001 From: Roger Ferrer Ibanez Date: Mon, 5 Dec 2016 11:05:09 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288660 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../strings/iterators.exceptions.pass.cpp | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/test/libcxx/strings/iterators.exceptions.pass.cpp b/test/libcxx/strings/iterators.exceptions.pass.cpp index 02ec921cc..b236c5180 100644 --- a/test/libcxx/strings/iterators.exceptions.pass.cpp +++ b/test/libcxx/strings/iterators.exceptions.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // // __libcpp_is_trivial_iterator @@ -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 > > ::value), ""); // iterators in the libc++ test suite - static_assert((!std::__libcpp_string_gets_noexcept_iterator >::value), ""); - static_assert((!std::__libcpp_string_gets_noexcept_iterator >::value), ""); - static_assert((!std::__libcpp_string_gets_noexcept_iterator >::value), ""); - static_assert((!std::__libcpp_string_gets_noexcept_iterator >::value), ""); - static_assert((!std::__libcpp_string_gets_noexcept_iterator >::value), ""); - static_assert((!std::__libcpp_string_gets_noexcept_iterator >::value), ""); + static_assert(std::__libcpp_string_gets_noexcept_iterator >::value == expected, ""); + static_assert(std::__libcpp_string_gets_noexcept_iterator >::value == expected, ""); + static_assert(std::__libcpp_string_gets_noexcept_iterator >::value == expected, ""); + static_assert(std::__libcpp_string_gets_noexcept_iterator >::value == expected, ""); + static_assert(std::__libcpp_string_gets_noexcept_iterator >::value == expected, ""); + static_assert(std::__libcpp_string_gets_noexcept_iterator >::value == expected, ""); #if TEST_STD_VER >= 11 static_assert(( std::__libcpp_string_gets_noexcept_iterator >::value), ""); #else - static_assert((!std::__libcpp_string_gets_noexcept_iterator >::value), ""); + static_assert(std::__libcpp_string_gets_noexcept_iterator >::value == expected, ""); #endif //