fork download
  1. struct Base { int a; };
  2.  
  3. struct TestFails
  4. {
  5. struct : public Base {};
  6. int b;
  7. };
  8.  
  9. struct TestWorks
  10. {
  11. struct { int a; };
  12. int b;
  13. };
  14.  
  15. int main()
  16. {
  17. TestWorks works;
  18. works.a = 0;
  19.  
  20. TestFails fails;
  21. fails.a = 0;
  22.  
  23. return 0;
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:21:8: error: 'struct TestFails' has no member named 'a'
  fails.a = 0;
        ^
stdout
Standard output is empty