public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/51711] New: regex.h contains incorrect code
@ 2011-12-30 6:09 ryanmolden at gmail dot com
2011-12-30 6:16 ` [Bug libstdc++/51711] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: ryanmolden at gmail dot com @ 2011-12-30 6:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51711
Bug #: 51711
Summary: regex.h contains incorrect code
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ryanmolden@gmail.com
The code in regex_replace looks like this
template <typename _Rx_traits, typename _Ch_type>
inline basic_string<_Ch_type>
regex_replace(const basic_string<_Ch_type>& __s,
const basic_regex<_Ch_type, _Rx_traits>& __e,
const basic_string<_Ch_type>& __fmt,
regex_constants::match_flag_type __flags,
= regex_constants::match_default)
{
std::string __result;
regex_replace(std::back_inserter(__result),
__s.begin(), __s.end(), __e, __fmt, __flags);
return __result;
}
However, the std::string is incorrect if you are attempting to use wstring and
wregex here (which should be allowed by all the other code which goes to pains
to use basic_string<_Ch_type>).
This code repros the bug:
#include <regex>
#include <string>
int main(int argc, char **argv)
{
std::wstring toProcess(L"Bug\r\n");
std::wstring result = std::regex_replace(toProcess, std::wregex(L"\\r"),
std::wstring(L"\\r"));
return 0;
}
compiled with:
g++ <filename> -std=c++0x +Wall
In file included from /usr/include/c++/4.6/regex:62:0,
from Test.cpp:1:
/usr/include/c++/4.6/bits/regex.h: In function std::basic_string<_Ch_type>
std::regex_replace(const std::basic_string<_Ch_type>&, const
std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&,
std::regex_constants::match_flag_type) [with _Rx_traits =
std::regex_traits<wchar_t>, _Ch_type = wchar_t,
std::regex_constants::match_flag_type = std::bitset<11ul>]:
Test.cpp:7:96: instantiated from here
/usr/include/c++/4.6/bits/regex.h:2225:14: error: could not convert __result
from std::string {aka std::basic_string<char>} to std::basic_string<wchar_t>
on Ubuntu 11.10 Server 64 bit edition with GCC 4.6.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/51711] regex.h contains incorrect code
2011-12-30 6:09 [Bug other/51711] New: regex.h contains incorrect code ryanmolden at gmail dot com
@ 2011-12-30 6:16 ` pinskia at gcc dot gnu.org
2011-12-30 10:59 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-30 6:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51711
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-12-30
Component|other |libstdc++
Ever Confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-30 06:15:17 UTC ---
Still a bug on the trunk:
t.cc:8:21: required from here
/home/pinskia/local-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/regex.h:2229:14:
error: could not convert ‘__result’ from ‘std::string {aka
std::basic_string<char>}’ to ‘std::basic_string<wchar_t>’
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/51711] regex.h contains incorrect code
2011-12-30 6:09 [Bug other/51711] New: regex.h contains incorrect code ryanmolden at gmail dot com
2011-12-30 6:16 ` [Bug libstdc++/51711] " pinskia at gcc dot gnu.org
@ 2011-12-30 10:59 ` paolo.carlini at oracle dot com
2011-12-30 11:41 ` paolo at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-30 10:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51711
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Target Milestone|--- |4.6.3
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-30 10:48:23 UTC ---
Mine.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/51711] regex.h contains incorrect code
2011-12-30 6:09 [Bug other/51711] New: regex.h contains incorrect code ryanmolden at gmail dot com
2011-12-30 6:16 ` [Bug libstdc++/51711] " pinskia at gcc dot gnu.org
2011-12-30 10:59 ` paolo.carlini at oracle dot com
@ 2011-12-30 11:41 ` paolo at gcc dot gnu.org
2011-12-30 11:42 ` paolo at gcc dot gnu.org
2011-12-30 12:37 ` paolo.carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-12-30 11:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51711
--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-12-30 11:40:42 UTC ---
Author: paolo
Date: Fri Dec 30 11:40:37 2011
New Revision: 182740
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182740
Log:
2011-12-30 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/51711
* include/bits/regex.h (regex_replace): Fix thinko.
* testsuite/28_regex/algorithms/regex_replace/char/51711.cc: New.
* testsuite/28_regex/algorithms/regex_replace/wchar_t/51711.cc:
Likewise.
Added:
trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/
trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/
trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/51711.cc
trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/wchar_t/
trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/wchar_t/51711.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/regex.h
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/51711] regex.h contains incorrect code
2011-12-30 6:09 [Bug other/51711] New: regex.h contains incorrect code ryanmolden at gmail dot com
` (2 preceding siblings ...)
2011-12-30 11:41 ` paolo at gcc dot gnu.org
@ 2011-12-30 11:42 ` paolo at gcc dot gnu.org
2011-12-30 12:37 ` paolo.carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-12-30 11:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51711
--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-12-30 11:40:55 UTC ---
Author: paolo
Date: Fri Dec 30 11:40:48 2011
New Revision: 182741
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182741
Log:
2011-12-30 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/51711
* include/bits/regex.h (regex_replace): Fix thinko.
* testsuite/28_regex/algorithms/regex_replace/char/51711.cc: New.
* testsuite/28_regex/algorithms/regex_replace/wchar_t/51711.cc:
Likewise.
Added:
branches/gcc-4_6-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/
branches/gcc-4_6-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/
branches/gcc-4_6-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/51711.cc
branches/gcc-4_6-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/wchar_t/
branches/gcc-4_6-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/wchar_t/51711.cc
Modified:
branches/gcc-4_6-branch/libstdc++-v3/ChangeLog
branches/gcc-4_6-branch/libstdc++-v3/include/bits/regex.h
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/51711] regex.h contains incorrect code
2011-12-30 6:09 [Bug other/51711] New: regex.h contains incorrect code ryanmolden at gmail dot com
` (3 preceding siblings ...)
2011-12-30 11:42 ` paolo at gcc dot gnu.org
@ 2011-12-30 12:37 ` paolo.carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-30 12:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51711
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-30 11:41:44 UTC ---
Fixed for 4.6.3.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-12-30 11:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-30 6:09 [Bug other/51711] New: regex.h contains incorrect code ryanmolden at gmail dot com
2011-12-30 6:16 ` [Bug libstdc++/51711] " pinskia at gcc dot gnu.org
2011-12-30 10:59 ` paolo.carlini at oracle dot com
2011-12-30 11:41 ` paolo at gcc dot gnu.org
2011-12-30 11:42 ` paolo at gcc dot gnu.org
2011-12-30 12:37 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).