[llvm-bugs] [Bug 34906] New: vector::insert(pos, iter, iter) incorrectly requires value-assignment for forward_iterators.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 10 12:47:41 PDT 2017


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

            Bug ID: 34906
           Summary: vector::insert(pos, iter, iter) incorrectly requires
                    value-assignment for forward_iterators.
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

According to the spec, this overload of `insert` doesn't require that the
elements in the vector be assignable from the iterator value_type. However
libc++ currently requires this.

Example: 

// clang++ -stdlib=libc++ -std=c++11 test.cpp
#include <vector>

template <class T>
  struct EmplaceConstructibleAndMoveable {
    explicit EmplaceConstructibleAndMoveable(T) {}
    EmplaceConstructibleAndMoveable(EmplaceConstructibleAndMoveable&&) =
default;
    EmplaceConstructibleAndMoveable&
operator=(EmplaceConstructibleAndMoveable&&)  = default;
 };

 int main() {
    using T = EmplaceConstructibleAndMoveable<int>;
    std::vector<T> v;
    int Inits[] = {1, 2, 3};
    v.insert(v.end(), std::begin(Inits), std::end(Inits));
}

-- 
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/20171010/a21b17c6/attachment.html>


More information about the llvm-bugs mailing list