Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\functional:10:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xmemory(758,76): error: call to implicitly-deleted copy constructor of 'std::pair<const unsigned int, Ex1>'
::new (const_cast<void*>(static_cast<const volatile void*>(_Ptr))) _Objty(_STD forward<_Types>(_Args)...);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\list(541,25): note: in instantiation of function template specialization 'std::_Default_allocator_traits<std::allocator<std::_List_node<std::pair<const unsigned int, Ex1>,
void *> > >::construct<std::pair<const unsigned int, Ex1>, const std::pair<const unsigned int, Ex1> &>' requested here
_Alnode_traits::construct(this->_Al, _STD addressof(this->_Ptr->_Myval), _STD forward<_Valtys>(_Vals)...);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xhash(620,45): note: in instantiation of function template specialization 'std::_List_node_emplace_op2<std::allocator<std::_List_node<std::pair<const unsigned int, Ex1>, void
*> > >::_List_node_emplace_op2<const std::pair<const unsigned int, Ex1> &>' requested here
_List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), _STD forward<_Valtys>(_Vals)...);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xhash(1089,13): note: in instantiation of function template specialization 'std::_Hash<std::_Umap_traits<unsigned int, Ex1, std::_Uhash_compare<unsigned int,
std::hash<unsigned int>, std::equal_to<unsigned int> >, std::allocator<std::pair<const unsigned int, Ex1> >, false> >::emplace<const std::pair<const unsigned int, Ex1> &>' requested here
emplace(*_UFirst);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xhash(408,9): note: in instantiation of function template specialization 'std::_Hash<std::_Umap_traits<unsigned int, Ex1, std::_Uhash_compare<unsigned int, std::hash<unsigned
int>, std::equal_to<unsigned int> >, std::allocator<std::pair<const unsigned int, Ex1> >, false> >::insert<std::_List_unchecked_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const unsigned int, Ex1> > >, std::_Iterator_base0> >' requested here
insert(_Right._Unchecked_begin(), _Right._Unchecked_end());
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\unordered_map(125,11): note: in instantiation of function template specialization 'std::_Hash<std::_Umap_traits<unsigned int, Ex1, std::_Uhash_compare<unsigned int,
std::hash<unsigned int>, std::equal_to<unsigned int> >, std::allocator<std::pair<const unsigned int, Ex1> >, false> >::_Hash<std::allocator<std::_List_node<std::pair<const unsigned int, Ex1>, void *> > >' requested here
: _Mybase(_Right,
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xmemory(758,76): note: (skipping 2 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
::new (const_cast<void*>(static_cast<const volatile void*>(_Ptr))) _Objty(_STD forward<_Types>(_Args)...);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xmemory(1616,22): note: in instantiation of function template specialization 'std::_Uninitialized_backout_al<std::allocator<std::unordered_map<unsigned int, Ex1,
std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<const unsigned int, Ex1> > > > >::_Emplace_back<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<const unsigned int,
Ex1> > > &>' requested here
_Backout._Emplace_back(*_UFirst);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\vector(1558,9): note: in instantiation of function template specialization 'std::_Uninitialized_copy<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>,
std::equal_to<unsigned int>, std::allocator<std::pair<const unsigned int, Ex1> > > *, std::allocator<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<const unsigned int, Ex1> > > > >' requested
here
_Uninitialized_copy(_First, _Last, _Dest, _Getal());
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\vector(1563,9): note: in instantiation of member function 'std::vector<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned int>,
std::allocator<std::pair<const unsigned int, Ex1> > >, std::allocator<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<const unsigned int, Ex1> > > > >::_Umove_if_noexcept1' requested here
_Umove_if_noexcept1(_First, _Last, _Dest,
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\vector(704,13): note: in instantiation of member function 'std::vector<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned int>,
std::allocator<std::pair<const unsigned int, Ex1> > >, std::allocator<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<const unsigned int, Ex1> > > > >::_Umove_if_noexcept' requested here
_Umove_if_noexcept(_Myfirst, _Mylast, _Newvec);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\vector(659,25): note: in instantiation of function template specialization 'std::vector<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned
int>, std::allocator<std::pair<const unsigned int, Ex1> > >, std::allocator<std::unordered_map<unsigned int, Ex1, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<const unsigned int, Ex1> > > > >::_Emplace_reallocate<>' requested here
_Ty& _Result = *_Emplace_reallocate(_Mylast, _STD forward<_Valty>(_Val)...);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\utility(137,5): note: explicitly defaulted function was implicitly deleted here
pair(const pair&) = default;
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\utility(240,10): note: copy constructor of 'pair<const unsigned int, Ex1>' is implicitly deleted because field 'second' has a deleted copy constructor
_Ty2 second; // the second stored value
^
.\electron\test.cpp(20,9): note: copy constructor of 'Ex1' is implicitly deleted because field 'e2_' has a deleted copy constructor
Ex2 e2_;
^
.\electron\test.cpp(14,5): note: 'Ex2' has been explicitly marked deleted here
Ex2(const Ex2&) = delete;
^
1 error generated.
// clang-cl.exe test.cpp "-imsvcC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\ATLMFC\include" "-imsvcC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include" -o test
#include <functional>
#include <iostream>
#include <memory>
#include <type_traits>
#include <vector>
#include <unordered_map>
class Ex2 {
public:
int n;
Ex2(Ex2&&) noexcept = default;
Ex2& operator=(Ex2&&) = default;
Ex2(const Ex2&) = delete;
Ex2& operator=(const Ex2) = delete;
};
struct Ex1 {
Ex1(Ex2 e2) : e2_(std::move(e2)) {}
Ex2 e2_;
std::unique_ptr<void*, std::function<void(void*)>> ptr;
};
int main() {
std::cout << std::boolalpha << "Ex1 is nothrow move-constructible? "
<< std::is_nothrow_move_constructible<Ex1>::value << '\n'
<< std::boolalpha << "Ex1 is copy-constructible? "
<< std::is_copy_constructible<Ex1>::value << '\n';
std::vector<std::unordered_map<uint32_t, Ex1>> mymap;
mymap.emplace_back();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.