diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c0dccdc..d7a0e0d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11049,7 +11049,7 @@ start_enum (tree name, tree underlying_type, bool scoped_enum_p) TYPE_UNSIGNED (enumtype) = TYPE_UNSIGNED (underlying_type); ENUM_UNDERLYING_TYPE (enumtype) = underlying_type; } - else + else if (!dependent_type_p (underlying_type)) error ("underlying type %<%T%> of %<%T%> must be an integral type", underlying_type, enumtype); } @@ -11095,6 +11095,8 @@ finish_enum (tree enumtype) TREE_TYPE (TREE_VALUE (values)) = enumtype; if (at_function_scope_p ()) add_stmt (build_min (TAG_DEFN, enumtype)); + if (SCOPED_ENUM_P (enumtype)) + finish_scope (); return; } @@ -11410,7 +11412,7 @@ build_enumerator (tree name, tree value, tree enumtype) TREE_READONLY (decl) = 1; DECL_INITIAL (decl) = value; - if (context && context == current_class_type) + if (context && context == current_class_type && !SCOPED_ENUM_P (enumtype)) /* In something like `struct S { enum E { i = 7 }; };' we put `i' on the TYPE_FIELDS list for `S'. (That's so that you can say things like `S::i' later.) */ |