This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, libstdc++/64649] Fix regex_traits::lookup_collatename and regex_traits::lookup_classname
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen at google dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 19 Jan 2015 13:23:29 +0000
- Subject: Re: [Patch, libstdc++/64649] Fix regex_traits::lookup_collatename and regex_traits::lookup_classname
- Authentication-results: sourceware.org; auth=none
- References: <CAG4ZjN=a3TG-qANYgtgt_e9vhhMCWxvChQRzcBHHYJrwKLszHg at mail dot gmail dot com>
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.