This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libstdc++/64649] Fix regex_traits::lookup_collatename and regex_traits::lookup_classname


On 17/01/15 23:09 -0800, Tim Shen wrote:
Bootstrapped and tested in trunk, but I guess it'll fit 4.9 branch
well. I'll do another test for 4.9 if it's appropriate to commit.

Thanks!


--
Regards,
Tim Shen

   	PR libstdc++/64649
   	* include/bits/regex.tcc (regex_traits<>::lookup_collatename,
   	regex_traits<>::lookup_classname): Conform forward iterator constrain
   	for lookup_collatename lookup_classname.

I think this is clearer:

   	* include/bits/regex.tcc (regex_traits<>::lookup_collatename,
   	regex_traits<>::lookup_classname): Support forward iterators.

   	* testsuite/28_regex/traits/char/lookup_classname.cc: New testcases.
   	* testsuite/28_regex/traits/char/lookup_collatename.cc: New testcase.

+      string __s(__first, __last);

This assumes the _ForwardIterator value_type is char, or safely
convertible to char. If I'm reading the standard correctly
regex_traits<wchar_t> should be able to accept an iterator range
referring to wide chars, e.g.

 std::forward_list<wchar_t> l{L't', L'i', L'l', L'd', L'e'};
 std::regex_traits<wchar_t>{}.lookup_collatename(l.begin(), l.end())

Maybe it's OK, because all the elements of __collatename use ASCII
chars which have the same value as wide chars? (Probably not true for
all locales).

Your change is definitely an improvement and good enough for now
(maybe we should leave the Bugzilla PR open, with a note about the
wide char issue, and deal with it after stage4).

OK for trunk - thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]