mirror of git://gcc.gnu.org/git/gcc.git
libstdc++: Fix sizeof(wide-string)-1 bug in std::regex test
This uses sizeof on a wide string to get the length, which is wrong because each wchar_t is more than one byte. This was presumably copied from a narrow char test. libstdc++-v3/ChangeLog: * testsuite/28_regex/basic_regex/assign/wchar_t/pstring.cc: Use wcslen(cs) instead of sizeof(cs)-1. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
This commit is contained in:
parent
1e13fb44f1
commit
f739d07b45
|
|
@ -23,6 +23,7 @@
|
||||||
// [28.8.3] class template basic_regex assign()
|
// [28.8.3] class template basic_regex assign()
|
||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <cwchar>
|
||||||
|
|
||||||
// Tests assign operation from a Pascal-style counted-string.
|
// Tests assign operation from a Pascal-style counted-string.
|
||||||
void test01()
|
void test01()
|
||||||
|
|
@ -31,7 +32,7 @@ void test01()
|
||||||
|
|
||||||
const wchar_t cs[] = L"aab";
|
const wchar_t cs[] = L"aab";
|
||||||
test_type re;
|
test_type re;
|
||||||
re.assign(cs, sizeof(cs)-1, std::regex_constants::basic);
|
re.assign(cs, std::wcslen(cs), std::regex_constants::basic);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue