#include <map>
struct A {
A(A& ); // <-- const missing
};
int main() {
std::map<int, A> m;
return 0;
}
I2luY2x1ZGUgPG1hcD4KCnN0cnVjdCBBIHsKICAgIEEoQSYgKTsgLy8gPC0tIGNvbnN0IG1pc3NpbmcKfTsKCmludCBtYWluKCkgewogICAgc3RkOjptYXA8aW50LCBBPiBtOwogICAgcmV0dXJuIDA7Cn0=
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0,
from /usr/include/c++/4.8/bits/stl_tree.h:61,
from /usr/include/c++/4.8/map:60,
from prog.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h: In instantiation of ‘struct std::pair<const int, A>’:
/usr/include/c++/4.8/bits/stl_tree.h:134:12: required from ‘struct std::_Rb_tree_node<std::pair<const int, A> >’
/usr/include/c++/4.8/bits/stl_tree.h:1125:25: required from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, A>; _KeyOfValue = std::_Select1st<std::pair<const int, A> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const int, A> >*]’
/usr/include/c++/4.8/bits/stl_tree.h:671:28: required from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = int; _Val = std::pair<const int, A>; _KeyOfValue = std::_Select1st<std::pair<const int, A> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >]’
/usr/include/c++/4.8/bits/stl_map.h:96:11: required from here
/usr/include/c++/4.8/bits/stl_pair.h:127:17: error: ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const int; _T2 = A]’ declared to take const reference, but implicit declaration would take non-const
constexpr pair(const pair&) = default;
^