fork(2) download
  1. #include <map>
  2.  
  3. struct A {
  4. A(A& ); // <-- const missing
  5. };
  6.  
  7. int main() {
  8. std::map<int, A> m;
  9. return 0;
  10. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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;
                 ^
stdout
Standard output is empty