From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A92DE384D16D; Thu, 7 Jul 2022 23:32:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A92DE384D16D From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/102480] std::regex fails to match ^ when match_prev_avail is used Date: Thu, 07 Jul 2022 23:32:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: Thu, 07 Jul 2022 23:32:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102480 --- Comment #4 from CVS Commits --- The releases/gcc-11 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:e61c16fd9ba89e7bc12284e524dcd8379c2bebfc commit r11-10120-ge61c16fd9ba89e7bc12284e524dcd8379c2bebfc Author: Jonathan Wakely Date: Wed Sep 29 13:48:19 2021 +0100 libstdc++: Implement std::regex_constants::multiline (LWG 2503) This implements LWG 2503, which allows ^ and $ to match line terminator characters, rather than only matching the beginning and end of the entire input. The multiline option is only valid for ECMAScript, but for other grammars we ignore it rather than throwing an exception. This is related to PR libstdc++/102480, which incorrectly said that ECMAscript should match the beginning of a line when match_prev_avail is used. I think that's only supposed to happen when multiline is used. The new regex_constants::multiline and basic_regex::multiline constants are not defined for strict -std=3Dc++11 and -std=3Dc++14 modes, but regex_constants::__multiline is always defined, so that the implementation can use it internally. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/regex.h (basic_regex::multiline): Define constant for C++17. * include/bits/regex_constants.h (regex_constants::multiline): Define constant for C++17. (regex_constants::__multiline): Define duplicate constant for internal use in C++11 and C++14. * include/bits/regex_executor.h (_Executor::_M_match_multiline(= )): New member function. (_Executor::_M_is_line_terminator(_CharT)): New member function. (_Executor::_M_at_begin(), _Executor::_M_at_end()): Use new member functions to support multiline matches. * testsuite/28_regex/algorithms/regex_match/multiline.cc: New t= est. (cherry picked from commit f38cd3bdb4cd429a5f7082ea91793a59b37d47b9)=