fork download
  1. int main() {
  2.  
  3. struct A{
  4. enum{
  5. green,
  6. red
  7. } color;
  8. };
  9.  
  10. A a;
  11. a.color=A::green;
  12. a.color=green; //Почему это не работает?
  13.  
  14. }
  15.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:12:10: error: use of undeclared identifier 'green'; did you mean 'A::green'?
        a.color=green; //Почему это не работает?
                ^~~~~
                A::green
prog.cpp:5:4: note: 'A::green' declared here
                        green,
                        ^
1 error generated.
stdout
Standard output is empty