fork download
  1. #include <tuple>
  2.  
  3. struct A {
  4. A(A& ); // <-- const missing
  5. };
  6.  
  7. int main() {
  8. std::pair<int, A> p;
  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/utility:70:0,
                 from /usr/include/c++/4.8/tuple:38,
                 from prog.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h: In instantiation of ‘struct std::pair<int, A>’:
prog.cpp:8:20:   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 = int; _T2 = A]’ declared to take const reference, but implicit declaration would take non-const
       constexpr pair(const pair&) = default;
                 ^
/usr/include/c++/4.8/bits/stl_pair.h: In instantiation of ‘constexpr std::pair<_T1, _T2>::pair() [with _T1 = int; _T2 = A]’:
prog.cpp:8:20:   required from here
/usr/include/c++/4.8/bits/stl_pair.h:109:25: error: no matching function for call to ‘A::A()’
       : first(), second() { }
                         ^
/usr/include/c++/4.8/bits/stl_pair.h:109:25: note: candidate is:
prog.cpp:4:5: note: A::A(A&)
     A(A& ); // <-- const missing
     ^
prog.cpp:4:5: note:   candidate expects 1 argument, 0 provided
stdout
Standard output is empty