[llvm-bugs] [Bug 47892] New: vector.resize failed to compile if move constructor is deleted with c++17

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 17 12:38:49 PDT 2020


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

            Bug ID: 47892
           Summary: vector.resize failed to compile if move constructor is
                    deleted with c++17
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yichen.yan at inf.ethz.ch
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

root at 834982c35017:/# /llvm-install/bin/clang++ --version
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
f2e08c688e6c3223d14c4817c5ce0b55c03a8d1b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /llvm-install/bin
root at 834982c35017:/# /llvm-install/bin/clang++ --std=c++17 -o /dev/null -c
test.cc
root at 834982c35017:/# /llvm-install/bin/clang++ --std=c++17 -stdlib=libc++ -o
/dev/null -c test.cc
In file included from test.cc:1:
In file included from /llvm-install/bin/../include/c++/v1/vector:276:
In file included from /llvm-install/bin/../include/c++/v1/__bit_reference:15:
In file included from /llvm-install/bin/../include/c++/v1/algorithm:643:
/llvm-install/bin/../include/c++/v1/memory:1634:13: error: static_assert failed
due to requirement '__is_cpp17_move_insertable<std::__1::allocator<S>,
false>::value' "The specified type does not meet the requirements of
Cpp17MoveInsertable"
            static_assert(__is_cpp17_move_insertable<allocator_type>::value,
            ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/llvm-install/bin/../include/c++/v1/vector:954:21: note: in instantiation of
function template specialization
'std::__1::allocator_traits<std::__1::allocator<S>>::__construct_backward_with_exception_guarantees<S
*>' requested here
    __alloc_traits::__construct_backward_with_exception_guarantees(
                    ^
/llvm-install/bin/../include/c++/v1/vector:1098:9: note: in instantiation of
member function 'std::__1::vector<S,
std::__1::allocator<S>>::__swap_out_circular_buffer' requested here
        __swap_out_circular_buffer(__v);
        ^
/llvm-install/bin/../include/c++/v1/vector:2027:15: note: in instantiation of
member function 'std::__1::vector<S, std::__1::allocator<S>>::__append'
requested here
        this->__append(__sz - __cs);
              ^
test.cc:12:5: note: in instantiation of member function 'std::__1::vector<S,
std::__1::allocator<S>>::resize' requested here
  v.resize(1);
    ^
1 error generated.
root at 834982c35017:/# cat test.cc
#include <vector>

class S {
  public:
    S();
    S(const S &);
    S(S &&) = delete;
};

int main() {
  std::vector < S > v;
  v.resize(1);
  return 0;
}

-- 
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/20201017/b130c61a/attachment.html>


More information about the llvm-bugs mailing list