From 605d62e9de00b9f95a00202f66dfb03fe52ca523 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 4 Jun 2019 15:18:46 +0000 Subject: No longer reject inputs when using a locale that has grouping information _and_ the input has no grouping characters at all. We continue to reject cases when the input has grouping characters in the wrong place. Fixes PR#28704 llvm-svn: 362508 --- libcxx/src/locale.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libcxx/src') diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index 00eb574ec45..ca0a1c9b15f 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -4379,7 +4379,9 @@ void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err) { - if (__grouping.size() != 0) +// if the grouping pattern is empty _or_ there are no grouping bits, then do nothing +// we always have at least a single entry in [__g, __g_end); the end of the input sequence + if (__grouping.size() >= 0 && __g_end - __g > 1) { reverse(__g, __g_end); const char* __ig = __grouping.data(); -- cgit v1.2.3