[LLVMbugs] [Bug 13994] New: Copy constructor incorrectly implicitly deleted
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Oct 2 09:06:43 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13994
Bug #: 13994
Summary: Copy constructor incorrectly implicitly deleted
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: andersca at icloud.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
When trying to compile
#include <vector>
class IntervalSet {
public:
IntervalSet();
IntervalSet(const IntervalSet&) = default;
IntervalSet& operator=(const IntervalSet&) = default;
IntervalSet(IntervalSet&&);
IntervalSet& operator=(IntervalSet&&);
};
struct List {
IntervalSet intervalSet;
List(List&&) = default;
struct S {
std::unique_ptr<int> ints;
};
std::vector<S> s;
};
std::vector<List> lists;
void f(List list)
{
lists.push_back(std::move(list));
}
I get the following error:
In file included from t.cpp:1:
In file included from /usr/bin/../lib/c++/v1/vector:261:
In file included from /usr/bin/../lib/c++/v1/__bit_reference:15:
In file included from /usr/bin/../lib/c++/v1/algorithm:594:
/usr/bin/../lib/c++/v1/memory:1677:31: error: call to implicitly-deleted copy
constructor of 'List::S'
::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/c++/v1/memory:1604:18: note: in instantiation of function
template specialization 'std::__1::allocator<List::S>::construct<List::S,
List::S &>' requested here
{__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
^
/usr/bin/../lib/c++/v1/memory:1488:14: note: in instantiation of function
template specialization
'std::__1::allocator_traits<std::__1::allocator<List::S>
>::__construct<List::S, List::S &>' requested here
{__construct(__has_construct<allocator_type, pointer, _Args...>(),
^
/usr/bin/../lib/c++/v1/vector:933:25: note: in instantiation of function
template specialization
'std::__1::allocator_traits<std::__1::allocator<List::S> >::construct<List::S,
List::S &>' requested here
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
*__first);
^
/usr/bin/../lib/c++/v1/vector:1100:9: note: in instantiation of function
template specialization 'std::__1::vector<List::S, std::__1::allocator<List::S>
>::__construct_at_end<List::S *>' requested here
__construct_at_end(__x.__begin_, __x.__end_);
^
t.cpp:14:8: note: in instantiation of member function
'std::__1::vector<List::S, std::__1::allocator<List::S> >::vector' requested
here
struct List {
^
/usr/bin/../lib/c++/v1/memory:1604:18: note: (skipping 2 contexts in backtrace;
use -ftemplate-backtrace-limit=0 to see all)
{__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
^
/usr/bin/../lib/c++/v1/memory:1569:17: note: in instantiation of function
template specialization 'std::__1::allocator_traits<std::__1::allocator<List>
>::construct<List, const List &>' requested here
construct(__a, _VSTD::__to_raw_pointer(--__end2),
_VSTD::move_if_noexcept(*--__end1));
^
/usr/bin/../lib/c++/v1/vector:809:21: note: in instantiation of function
template specialization 'std::__1::allocator_traits<std::__1::allocator<List>
>::__construct_backward<List *>' requested here
__alloc_traits::__construct_backward(this->__alloc(), this->__begin_,
this->__end_, __v.__begin_);
^
/usr/bin/../lib/c++/v1/vector:1461:5: note: in instantiation of member function
'std::__1::vector<List, std::__1::allocator<List>
>::__swap_out_circular_buffer' requested here
__swap_out_circular_buffer(__v);
^
/usr/bin/../lib/c++/v1/vector:1494:9: note: in instantiation of function
template specialization 'std::__1::vector<List, std::__1::allocator<List>
>::__push_back_slow_path<List>' requested here
__push_back_slow_path(_VSTD::move(__x));
^
t.cpp:30:9: note: in instantiation of member function 'std::__1::vector<List,
std::__1::allocator<List> >::push_back' requested here
lists.push_back(std::move(list));
^
t.cpp:19:12: note: 'S' defined here
struct S {
^
1 error generated.
Adding = default to the IntervalSet move constructor causes the error to go
away.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list