fork download
  1. #include <iostream>
  2. #include <map>
  3.  
  4. void foo(const std::map<int, const double&>& a) {};
  5.  
  6. int main() {
  7. std::map<int, double&> test;
  8.  
  9. foo(test);
  10. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:10: error: invalid initialization of reference of type 'const std::map<int, const double&>&' from expression of type 'std::map<int, double&>'
  foo(test);
          ^
prog.cpp:4:6: note: in passing argument 1 of 'void foo(const std::map<int, const double&>&)'
 void foo(const std::map<int, const double&>& a) {};
      ^
stdout
Standard output is empty