fork download
  1. class X;
  2.  
  3. struct F
  4. {
  5. void Foo( X x = X() );
  6.  
  7. float f;
  8. };
  9.  
  10. class X
  11. {
  12. public:
  13. X() {};
  14. };
  15.  
  16. void F::Foo( X x )
  17. {
  18. };
  19.  
  20. int main()
  21. {
  22. F f;
  23. f.Foo();
  24. }
Compilation error #stdin compilation error #stdout 0s 15224KB
stdin
Standard input is empty
compilation info
prog.cpp:5:21: error: invalid use of incomplete type ‘class X’
   void Foo( X x = X() );
                     ^
prog.cpp:1:7: note: forward declaration of ‘class X’
 class X;
       ^
prog.cpp: In function ‘int main()’:
prog.cpp:23:8: error: call to ‘void F::Foo(X)’ uses the default argument for parameter 1, which is not yet defined
  f.Foo();
        ^
stdout
Standard output is empty