public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/103664] New: std::regex_replace bug if the string contains \0
@ 2021-12-11 21:52 artur77 at freemail dot hu
  2021-12-12  2:39 ` [Bug libstdc++/103664] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: artur77 at freemail dot hu @ 2021-12-11 21:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103664

            Bug ID: 103664
           Summary: std::regex_replace bug if the string contains \0
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: artur77 at freemail dot hu
  Target Milestone: ---

I think I found a bug in std::regex_replace.

The following code should write "1a b2" with length 5, but it writes "1a2" with
length 3.


#include <iostream>
#include <regex>

using namespace std;
int main()
{
    string a = regex_replace("1<sn>2", std::regex("<sn>"), string("a\0b", 3));

    cout << "a: " << a << "\n";
    cout << a.length();

    return 0;
}

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-06-23 16:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-11 21:52 [Bug libstdc++/103664] New: std::regex_replace bug if the string contains \0 artur77 at freemail dot hu
2021-12-12  2:39 ` [Bug libstdc++/103664] " pinskia at gcc dot gnu.org
2021-12-12 12:26 ` redi at gcc dot gnu.org
2021-12-12 12:34 ` redi at gcc dot gnu.org
2021-12-13 11:16 ` cvs-commit at gcc dot gnu.org
2021-12-13 11:50 ` redi at gcc dot gnu.org
2022-07-07 23:32 ` cvs-commit at gcc dot gnu.org
2023-06-09  9:47 ` redi at gcc dot gnu.org
2023-06-23 16:12 ` cvs-commit at gcc dot gnu.org
2023-06-23 16:18 ` redi at gcc dot gnu.org

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).