aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-07-07 13:55:26 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-07-07 13:55:26 -0400
commit60662d5f6b46ac07220fec38e64d01eeb912d96d (patch)
tree10ea675a39bd0af7e05a1c3383ae729e5ebb46db /gcc/cp/decl.c
parent72f90fdede20e1f9fcbc34e8001f7b28180699bf (diff)
downloadgcc-60662d5f6b46ac07220fec38e64d01eeb912d96d.zip
gcc-60662d5f6b46ac07220fec38e64d01eeb912d96d.tar.gz
gcc-60662d5f6b46ac07220fec38e64d01eeb912d96d.tar.bz2
re PR c++/37816 ([c++0x] Invalid handling of scoped enums defined at class scope)
PR c++/37816 * decl.c (build_enumerator): Don't add enumerators for a scoped enum to the enclosing class. PR c++/40639 * decl.c (start_enum): Allow dependent underlying type. PR c++/40633 * decl.c (finish_enum): Finish scope even in a template. From-SVN: r149341
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c6
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.) */