[llvm-bugs] [Bug 31378] New: list::remove should not require allocator to have default constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 14 14:27:24 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31378

            Bug ID: 31378
           Summary: list::remove should not require allocator to have
                    default constructor
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lukasl at ca.ibm.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

The current libc++ implementation of `std::list::remove` uses the default
constructor of `std::list`:

> list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing

This subsequently calls the default constructor of `_Alloc`. However, reading
through section 17.6.3.5 ("Allocator requirements") of the C++11 standard
draft, it appears allocators are not required to be DefaultConstructable.

I believe the constructor of `__deleted_nodes` should simply be given the
allocator instance of the existing list:

> list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161214/6134bace/attachment.html>


More information about the llvm-bugs mailing list