2011-06-20 Jason Merrill <jason@redhat.com>
+ PR c++/47635
+ * decl.c (grokdeclarator): Don't set ctype to an ENUMERAL_TYPE.
+
PR c++/48138
* tree.c (strip_typedefs): Use build_aligned_type.
else if (TYPE_P (qualifying_scope))
{
ctype = qualifying_scope;
- if (innermost_code != cdk_function
- && current_class_type
- && !UNIQUELY_DERIVED_FROM_P (ctype,
- current_class_type))
+ if (!MAYBE_CLASS_TYPE_P (ctype))
+ {
+ error ("%q#T is not a class or a namespace", ctype);
+ ctype = NULL_TREE;
+ }
+ else if (innermost_code != cdk_function
+ && current_class_type
+ && !UNIQUELY_DERIVED_FROM_P (ctype,
+ current_class_type))
{
error ("type %qT is not derived from type %qT",
ctype, current_class_type);
would not have exited the loop above. */
if (declarator
&& declarator->u.id.qualifying_scope
- && TYPE_P (declarator->u.id.qualifying_scope))
+ && MAYBE_CLASS_TYPE_P (declarator->u.id.qualifying_scope))
{
tree t;
"declared out of global scope", name);
}
- if (ctype != NULL_TREE
- && TREE_CODE (ctype) != NAMESPACE_DECL && !MAYBE_CLASS_TYPE_P (ctype))
- {
- error ("%q#T is not a class or a namespace", ctype);
- ctype = NULL_TREE;
- }
-
if (ctype == NULL_TREE)
{
if (virtualp)