1 // { dg-do compile } 2 // { dg-options "-std=c++0x" } 3 enum class Col { red, yellow, green }; 4 5 int x = Col::red; // { dg-error "cannot convert" } 6 Col y = Col::red; 7 f()8void f() 9 { 10 if (y) { } // { dg-error "could not convert" } 11 } 12 13 enum direction { left='l', right='r' }; g()14void g() { 15 // OK 16 direction d; 17 // OK 18 d = left; 19 // OK 20 d = direction::right; 21 } 22 enum class altitude { high='h', low='l' }; h()23void h() { 24 altitude a; 25 a = high; // { dg-error "not declared in this scope" } 26 a = altitude::low; 27 } 28