Index: test/libcxx/strings/iterators.exceptions.pass.cpp =================================================================== --- test/libcxx/strings/iterators.exceptions.pass.cpp +++ test/libcxx/strings/iterators.exceptions.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // // __libcpp_is_trivial_iterator @@ -26,6 +25,17 @@ #include "test_macros.h" #include "test_iterators.h" +#ifndef TEST_HAS_NO_EXCEPTIONS +// Wrapper for tests that expect a false noexcept. Usually a no-op but +// see comment after #else. +#define TEST_FOR_FALSE(x) (x) +#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, so we negate the result. +#define TEST_FOR_FALSE(x) (!(x)) +#endif + int main() { // basic tests @@ -43,17 +53,17 @@ 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(TEST_FOR_FALSE(!std::__libcpp_string_gets_noexcept_iterator >::value), ""); + static_assert(TEST_FOR_FALSE(!std::__libcpp_string_gets_noexcept_iterator >::value), ""); + static_assert(TEST_FOR_FALSE(!std::__libcpp_string_gets_noexcept_iterator >::value), ""); + static_assert(TEST_FOR_FALSE(!std::__libcpp_string_gets_noexcept_iterator >::value), ""); + static_assert(TEST_FOR_FALSE(!std::__libcpp_string_gets_noexcept_iterator >::value), ""); + static_assert(TEST_FOR_FALSE(!std::__libcpp_string_gets_noexcept_iterator >::value), ""); #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(TEST_FOR_FALSE(!std::__libcpp_string_gets_noexcept_iterator >::value), ""); #endif //