Under libcpp-no-exceptions, noexcept is trivially true. Some tests expect in the usual setting to return false. Wrap these tests in a convenience macro.
Details
Diff Detail
Event Timeline
Have you tested this against GCC which has different noexcept semantics?
If so this LGTM minus possibly addressing the inline comments.
test/libcxx/strings/iterators.exceptions.pass.cpp | ||
---|---|---|
55 | I would prefer something like this if possible: #ifndef TEST_HAS_NO_EXCEPTIONS static const bool expect = false; #else static const bool expect = true; #endif static_assert(std::__libcpp_string_gets_noexcept_iterator<...>::value == expect); (Also the double negation of TEST_FOR_FALSE(!foo) is weird) |
- Rewrite the adjusted tests in the way suggested by @EricWF
- Also check that this test works in a GCC-built libcxx
Please address the inline comments before committing.
test/libcxx/strings/iterators.exceptions.pass.cpp | ||
---|---|---|
29 | We can't use constexpr because these tests run in C++03. However const bool expected = ... should give you a value you can use in constant expressions. |
test/libcxx/strings/iterators.exceptions.pass.cpp | ||
---|---|---|
29 | Ah, I was confused by the usage of C++11 headers in this file but I will use a static const bool instead. Thanks. |
test/libcxx/strings/iterators.exceptions.pass.cpp | ||
---|---|---|
29 | No worries. It is super confusing, especially since we can use static_assert but not constexpr. Libc++ goes out of its way to provide as much C++11 in C++03 as possible, but there are weird limitations. |
We can't use constexpr because these tests run in C++03. However const bool expected = ... should give you a value you can use in constant expressions.