From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 802B9386103F; Wed, 10 Jul 2024 22:07:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 802B9386103F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1720649241; bh=hIPksPrhOggqQIaX1AF15e3bejACQ629ZZJlMNTDXJ4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hCF1Jyd7XRZFQBUH2tsgREpGF173okeEY2PL5bXn92v12kcWDuBD8V4VmeaKxlHoZ TDJFn4OZsJKIIK39+S3gfa71wjEdnLw9aarcuM6w45UhgWhCdNsDoRDIWkrDWrlrw/ HpEEnVOCNl50rfr2FLkysaoVkjX/Swy2N6nm5ZLw= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/108619] Compilation error if the construct method of the allocator isn't implemented and the detructor of value_type is private Date: Wed, 10 Jul 2024 22:07:19 +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.2.1 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: 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: assigned_to 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108619 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu= .org --- Comment #12 from Jonathan Wakely --- This fails for all modes from C++11 to C++20: #include #include #include class a { ~a() =3D default; friend class b; }; class b { template struct alloc { std::allocator a; alloc() { } template alloc(const alloc&) { } using value_type =3D C; C* allocate(std::size_t n) { return a.allocate(n); } void deallocate(C* p, std::size_t n) { return a.deallocate(p, n); } template void destroy(U* p){ if constexpr (std::is_array_v){ for(auto& elem : *p){ (destroy)(std::addressof(elem)); } } else { p->~U(); } } }; std::vector> v; public: void f(){ v.emplace_back(); } }; I have a patch ...=