fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. namespace Your{
  5. struct Foo{
  6. int i = 5;
  7. Foo(){}
  8. Foo(Foo &foo){
  9. i = foo.i;
  10. }
  11. };
  12. }
  13.  
  14. namespace Mine{
  15. struct Foo{
  16. int i = 5;
  17. Foo(){}
  18. Foo(const Foo &foo){
  19. i = foo.i;
  20. }
  21. };
  22. }
  23.  
  24.  
  25. int main(){
  26. {const Mine::Foo foo, copiedFoo(foo);}
  27. {const Your::Foo foo, copiedFoo(foo);}
  28. return 0;
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:27:37: error: no matching function for call to 'Your::Foo::Foo(const Your::Foo&)'
  {const Your::Foo foo, copiedFoo(foo);}
                                     ^
prog.cpp:27:37: note: candidates are:
prog.cpp:8:3: note: Your::Foo::Foo(Your::Foo&)
   Foo(Foo &foo){
   ^
prog.cpp:8:3: note:   no known conversion for argument 1 from 'const Your::Foo' to 'Your::Foo&'
prog.cpp:7:3: note: Your::Foo::Foo()
   Foo(){}
   ^
prog.cpp:7:3: note:   candidate expects 0 arguments, 1 provided
stdout
Standard output is empty