diff --git a/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp b/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp --- a/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp @@ -24,31 +24,46 @@ // const char* what() const throw(); #include -#include +#include #include #include "test_macros.h" int main(int, char**) { + std::string s[4]; + { std::future_error f(std::make_error_code(std::future_errc::broken_promise)); - LIBCPP_ASSERT(std::strcmp(f.what(), "The associated promise has been destructed prior " - "to the associated state becoming ready.") == 0); + s[0] = std::string(f.what()); + LIBCPP_ASSERT(s[0] == "The associated promise has been destructed prior " + "to the associated state becoming ready."); } { std::future_error f(std::make_error_code(std::future_errc::future_already_retrieved)); - LIBCPP_ASSERT(std::strcmp(f.what(), "The future has already been retrieved from " - "the promise or packaged_task.") == 0); + s[1] = std::string(f.what()); + LIBCPP_ASSERT(s[1] == "The future has already been retrieved from " + "the promise or packaged_task."); } { std::future_error f(std::make_error_code(std::future_errc::promise_already_satisfied)); - LIBCPP_ASSERT(std::strcmp(f.what(), "The state of the promise has already been set.") == 0); + s[2] = std::string(f.what()); + LIBCPP_ASSERT(s[2] == "The state of the promise has already been set."); } { std::future_error f(std::make_error_code(std::future_errc::no_state)); - LIBCPP_ASSERT(std::strcmp(f.what(), "Operation not permitted on an object without " - "an associated state.") == 0); + s[3] = std::string(f.what()); + LIBCPP_ASSERT(s[3] == "Operation not permitted on an object without " + "an associated state."); + } + + for ( int i = 0; i < 4; i++ ) + { + assert(s[i].length() != 0); + for ( int j = i+1; j < 4; j++ ) + { + assert(s[i].compare(s[j]) != 0); + } } return 0;