From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6795E3858D3C; Fri, 24 Sep 2021 23:34:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6795E3858D3C From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/102480] New: std::regex fails to match ^ when match_prev_avail is used Date: Fri, 24 Sep 2021 23:34:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter blocked target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 23:34:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102480 Bug ID: 102480 Summary: std::regex fails to match ^ when match_prev_avail is used Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Blocks: 102445 Target Milestone: --- #include #include int main() { char str[] =3D "\na"; std::regex re("^a"); assert(std::regex_match(str + 1, str + 2, re)); using std::regex_constants::match_prev_avail; assert(std::regex_match(str + 1, str + 2, re, match_prev_avail)); } Both assertions should pass. For the first match, the regex matches at the beginning of the input. For the second match, the regex should also match because the previous character is a line terminator. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102445 [Bug 102445] [meta-bug] std::regex issues=