+2015-10-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/66781
+ * parser.c (cp_parser_enum_specifier): Upon error_at set
+ nested_name_specifier to error_mark_node; improve error message.
+
+2015-10-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/67847
+ * parser.c (cp_parser_enum_specifier): Reject a nested_name_specifier
+ which doesn't name a class or namespace.
+
2015-10-21 Ilya Enkovich <enkovich.gnu@gmail.com>
* call.c (build_conditional_expr_1): Use boolean vector
else if (nested_name_specifier == error_mark_node)
/* We already issued an error. */;
else
- error_at (type_start_token->location,
- "%qD is not an enumerator-name", identifier);
+ {
+ error_at (type_start_token->location,
+ "%qD does not name an enumeration in %qT",
+ identifier, nested_name_specifier);
+ nested_name_specifier = error_mark_node;
+ }
}
else
{
nested_name_specifier);
type = error_mark_node;
}
+ else if (TREE_CODE (nested_name_specifier) != NAMESPACE_DECL
+ && !CLASS_TYPE_P (nested_name_specifier))
+ {
+ error_at (type_start_token->location, "nested name specifier "
+ "%qT for enum declaration does not name a class "
+ "or namespace", nested_name_specifier);
+ type = error_mark_node;
+ }
/* If that scope does not contain the scope in which the
class was originally declared, the program is invalid. */
else if (prev_scope && !is_ancestor (prev_scope,
+2015-10-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/66781
+ * g++.dg/parse/enum13.C: New.
+
+2015-10-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/67847
+ * g++.dg/parse/enum12.C: New.
+
2015-10-21 Martin Sebor <msebor@redhat.com>
PR driver/68043