diff --git a/include/regex b/include/regex index 5e1c37c6..690213a9 100644 --- a/include/regex +++ b/include/regex @@ -4926,7 +4926,7 @@ bool operator==(const basic_string::value_type, _ST, _SA>& __x, const sub_match<_BiIter>& __y) { - return __y.compare(__x.c_str()) == 0; + return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) == 0; } template @@ -4944,7 +4944,7 @@ bool operator<(const basic_string::value_type, _ST, _SA>& __x, const sub_match<_BiIter>& __y) { - return __y.compare(__x.c_str()) > 0; + return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) > 0; } template @@ -4979,7 +4979,7 @@ bool operator==(const sub_match<_BiIter>& __x, const basic_string::value_type, _ST, _SA>& __y) { - return __x.compare(__y.c_str()) == 0; + return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) == 0; } template @@ -4997,7 +4997,7 @@ bool operator<(const sub_match<_BiIter>& __x, const basic_string::value_type, _ST, _SA>& __y) { - return __x.compare(__y.c_str()) < 0; + return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) < 0; } template diff --git a/test/re/re.submatch/re.submatch.op/compare.pass.cpp b/test/re/re.submatch/re.submatch.op/compare.pass.cpp index 45e72adc..3a500d37 100644 --- a/test/re/re.submatch/re.submatch.op/compare.pass.cpp +++ b/test/re/re.submatch/re.submatch.op/compare.pass.cpp @@ -218,7 +218,7 @@ template void -test(const std::basic_string& x, const std::basic_string& y) +test(const std::basic_string& x, const std::basic_string& y, bool doCStrTests = true) { typedef std::basic_string string; typedef std::sub_match sub_match; @@ -248,18 +248,20 @@ test(const std::basic_string& x, const std::basic_string& y) assert((sm1 > y) == (x > y)); assert((sm1 <= y) == (x <= y)); assert((sm1 >= y) == (x >= y)); - assert((x.c_str() == sm2) == (x == y)); - assert((x.c_str() != sm2) == (x != y)); - assert((x.c_str() < sm2) == (x < y)); - assert((x.c_str() > sm2) == (x > y)); - assert((x.c_str() <= sm2) == (x <= y)); - assert((x.c_str() >= sm2) == (x >= y)); - assert((sm1 == y.c_str()) == (x == y)); - assert((sm1 != y.c_str()) == (x != y)); - assert((sm1 < y.c_str()) == (x < y)); - assert((sm1 > y.c_str()) == (x > y)); - assert((sm1 <= y.c_str()) == (x <= y)); - assert((sm1 >= y.c_str()) == (x >= y)); + if (doCStrTests) { + assert((x.c_str() == sm2) == (x == y)); + assert((x.c_str() != sm2) == (x != y)); + assert((x.c_str() < sm2) == (x < y)); + assert((x.c_str() > sm2) == (x > y)); + assert((x.c_str() <= sm2) == (x <= y)); + assert((x.c_str() >= sm2) == (x >= y)); + assert((sm1 == y.c_str()) == (x == y)); + assert((sm1 != y.c_str()) == (x != y)); + assert((sm1 < y.c_str()) == (x < y)); + assert((sm1 > y.c_str()) == (x > y)); + assert((sm1 <= y.c_str()) == (x <= y)); + assert((sm1 >= y.c_str()) == (x >= y)); + } assert((x[0] == sm2) == (string(1, x[0]) == y)); assert((x[0] != sm2) == (string(1, x[0]) != y)); assert((x[0] < sm2) == (string(1, x[0]) < y)); @@ -280,4 +282,6 @@ int main() test(std::string("1234"), std::string("123")); test(std::wstring(L"123"), std::wstring(L"123")); test(std::wstring(L"1234"), std::wstring(L"123")); + test(std::string("123\056", 6), std::string("123\056", 6), false); + test(std::wstring(L"123\056", 6), std::wstring(L"123\056", 6), false); } diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index caa750b5..16b16f77 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -87,7 +87,7 @@ 2106move_iterator wrapping iterators returning prvaluesUrbana 2129User specializations of std::initializer_listUrbanaComplete 2212tuple_size for const pair request headerUrbanaComplete - 2217operator==(sub_match, string) slices on embedded '\0'sUrbana + 2217operator==(sub_match, string) slices on embedded '\0'sUrbanaComplete 2230"see below" for initializer_list constructors of unordered containersUrbanaComplete 2233bad_function_call::what() unhelpfulUrbanaComplete 2266vector and deque have incorrect insert requirementsUrbana