fork download
  1. #include <iostream>
  2. using namespace std;
  3. typedef struct { int dummy; } BAZ;
  4.  
  5. class Foo {
  6. //private:
  7. //Foo(void) {}
  8.  
  9. public:
  10. Foo(BAZ a) { }
  11. };
  12.  
  13. class Bar {
  14. private:
  15. Foo foo1;
  16. Foo foo2;
  17.  
  18. //Bar(void) {}
  19.  
  20. public:
  21. Bar(BAZ a, BAZ b) : foo1(a), foo2(b) { }
  22. };
  23.  
  24. int main() {
  25. Foo foo1;
  26. return 0;
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:25:6: error: no matching function for call to ‘Foo::Foo()’
  Foo foo1;
      ^~~~
prog.cpp:10:5: note: candidate: Foo::Foo(BAZ)
     Foo(BAZ a) {  }
     ^~~
prog.cpp:10:5: note:   candidate expects 1 argument, 0 provided
prog.cpp:5:7: note: candidate: constexpr Foo::Foo(const Foo&)
 class Foo {
       ^~~
prog.cpp:5:7: note:   candidate expects 1 argument, 0 provided
prog.cpp:5:7: note: candidate: constexpr Foo::Foo(Foo&&)
prog.cpp:5:7: note:   candidate expects 1 argument, 0 provided
stdout
Standard output is empty