fork download
  1. struct Baz
  2. {
  3. Baz() : x(0) {}
  4.  
  5. int x;
  6. };
  7.  
  8. struct Foo
  9. {
  10. explicit Foo(const Baz& baz) : x(baz.x) {}
  11.  
  12. int x;
  13. };
  14.  
  15. int get_foo_val()
  16. {
  17. Foo bar(Baz());
  18. return bar.x;
  19. }
  20.  
  21. int main()
  22. {
  23. return get_foo_val();
  24. }
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int get_foo_val()’:
prog.cpp:18:13: error: request for member ‘x’ in ‘bar’, which is of non-class type ‘Foo(Baz (*)())’
  return bar.x;
             ^
stdout
Standard output is empty