diff --git a/regression/cpp/enum_class1/main.cpp b/regression/cpp/enum_class1/main.cpp index db133f6eaaa..634b9dbbc34 100644 --- a/regression/cpp/enum_class1/main.cpp +++ b/regression/cpp/enum_class1/main.cpp @@ -14,4 +14,7 @@ int main() { Color1 c; c=Color1::red; + + Color2 c2; + c2 = red; } diff --git a/regression/cpp/enum_class1/test.desc b/regression/cpp/enum_class1/test.desc index 0daa9695017..3862862ffd3 100644 --- a/regression/cpp/enum_class1/test.desc +++ b/regression/cpp/enum_class1/test.desc @@ -1,4 +1,4 @@ -KNOWNBUG +CORE main.cpp -std=c++11 ^EXIT=0$ diff --git a/src/cpp/cpp_typecheck_enum_type.cpp b/src/cpp/cpp_typecheck_enum_type.cpp index c7893c3c06a..e4481866b12 100644 --- a/src/cpp/cpp_typecheck_enum_type.cpp +++ b/src/cpp/cpp_typecheck_enum_type.cpp @@ -193,6 +193,12 @@ void cpp_typecheckt::typecheck_enum_type(typet &type) cpp_scopes.put_into_scope(*new_symbol, dest_scope); scope_identifier.id_class=cpp_idt::id_classt::CLASS; + scope_identifier.is_scope = true; + + cpp_save_scopet save_scope(cpp_scopes); + + if(new_symbol->type.get_bool(ID_C_class)) + cpp_scopes.go_to(scope_identifier); typecheck_enum_body(*new_symbol); } diff --git a/src/cpp/parse.cpp b/src/cpp/parse.cpp index e658d418aa4..7246108160f 100644 --- a/src/cpp/parse.cpp +++ b/src/cpp/parse.cpp @@ -4039,7 +4039,6 @@ bool Parser::rEnumSpec(typet &spec) #endif cpp_tokent tk; - // bool is_enum_class=false; if(lex.get_token(tk)!=TOK_ENUM) return false; @@ -4053,7 +4052,7 @@ bool Parser::rEnumSpec(typet &spec) if(lex.LookAhead(0)==TOK_CLASS) { lex.get_token(tk); - // is_enum_class=true; + spec.set(ID_C_class, true); } if(lex.LookAhead(0)!='{' &&