===================================================================
@@ -15194,6 +15188,12 @@ cp_parser_elaborated_type_specifier (cp_parser* pa
identifier. */
if (!template_p && !cp_parser_parse_definitely (parser))
;
+ else if (tag_type == typename_type
+ && BASELINK_P (decl))
+ {
+ cp_parser_diagnose_invalid_type_name (parser, decl, token->location);
+ type = error_mark_node;
+ }
/* If DECL is a TEMPLATE_ID_EXPR, and the `typename' keyword is
in effect, then we must assume that, upon instantiation, the
template will correspond to a class. */