From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17266 invoked by alias); 18 Aug 2011 14:34:44 -0000 Received: (qmail 17122 invoked by uid 22791); 18 Aug 2011 14:34:43 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Aug 2011 14:34:17 +0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/50118] New: node-based containers cannot use allocators with explicit constructor template Date: Thu, 18 Aug 2011 14:38:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg01596.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50118 Bug #: 50118 Summary: node-based containers cannot use allocators with explicit constructor template Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: redi@gcc.gnu.org #include #include #include #include template struct Alloc : std::allocator { Alloc() { } template explicit // N.B. explicit ****** Alloc(const Alloc&) { } template struct rebind { typedef Alloc other; }; }; Alloc a; std::list > l(a); typedef std::less Cmp; Cmp cmp; std::set > s(cmp, a); std::map > m(cmp, a); As far as I can tell there is no requirement in the standard that says Alloc must be implicitly convertible to Alloc, so the node-based containers which rebind allocators from Alloc to Alloc need to convert explicitly e.g. in stl_list.h _List_base(const allocator_type& __a) - : _M_impl(__a) + : _M_impl(_Node_alloc_type(__a)) { _M_init(); } Alternatively, _List_base::_List_impl could be constructible from the original allocator_type and do the conversion there