From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A52BC3858412; Mon, 24 Oct 2022 12:46:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A52BC3858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666615610; bh=qxefmpIcgSKN3TySeN7T291FGCgiyyWrfqdqI+TEIsA=; h=From:To:Subject:Date:From; b=J4H/WQh3n7oLNqUepHORTDqkIXbNebjk8v/6N9na18aiP/Ec8ApiglyKht4COpO4H oESOStVwRvnd3xrPpBBC6zjCoafzV5sF0xpo42pPVJs7ApBiUhu17p3yZDRT8Pw2r6 jpbZbQIz/qCDvhmt9/zKaK4E31DoS++OvGxiDT6U= From: "listcrawler at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107376] New: regex executor requires allocator to be default constructible Date: Mon, 24 Oct 2022 12:46:50 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: listcrawler at gmail dot com 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 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107376 Bug ID: 107376 Summary: regex executor requires allocator to be default constructible Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: listcrawler at gmail dot com Target Milestone: --- To recreate problem: #include #include template struct Alloc { using value_type =3D T; T* allocate(std::size_t n) { return std::allocator{}.allocate(n); } void deallocate(T* p, std::size_t n) { std::allocator{}.deallocate(p, n); } ~Alloc() =3D default; //explicit Alloc() =3D default; explicit Alloc(int) {} Alloc(Alloc const&) =3D default; Alloc(Alloc && rhs) =3D default; Alloc& operator=3D(Alloc const&) =3D default; Alloc& operator=3D(Alloc && rhs) =3D default; template Alloc(Alloc const& rhs) {} template Alloc(Alloc && rhs) {} template Alloc& operator=3D(Alloc const& rhs) {} template Alloc& operator=3D(Alloc && rhs) {} }; template bool operator=3D=3D(Alloc const&, Alloc const&) { return true; } template bool operator!=3D(Alloc const&, Alloc const&) { return false; } // =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D template using A =3D Alloc; using S =3D std::string; using SIt =3D typename S::const_iterator; using SubMatch =3D std::sub_match; using Match =3D std::match_results>; int main() { S s {"foo"}; Match m {A{0}}; std::regex r {"foo"}; std::regex_match(s, m, r); } Suggested patch: diff --git a/libstdc++-v3/include/bits/regex_executor.h b/libstdc++-v3/include/bits/regex_executor.h index dc0878ce6..080a1134e 100644 --- a/libstdc++-v3/include/bits/regex_executor.h +++ b/libstdc++-v3/include/bits/regex_executor.h @@ -71,7 +71,8 @@ namespace __detail _ResultsVec& __results, const _RegexT& __re, _FlagT __flags) - : _M_begin(__begin), + : _M_cur_results(__results.get_allocator()) + , _M_begin(__begin), _M_end(__end), _M_re(__re), _M_nfa(*__re._M_automaton),=