static void cp_parser_check_for_definition_in_return_type
(cp_declarator *, tree, location_t type_location);
static void cp_parser_check_for_invalid_template_id
- (cp_parser *, tree, location_t location);
+ (cp_parser *, tree, enum tag_types, location_t location);
static bool cp_parser_non_integral_constant_expression
(cp_parser *, non_integral_constant);
static void cp_parser_diagnose_invalid_type_name
static void
cp_parser_check_for_invalid_template_id (cp_parser* parser,
- tree type, location_t location)
+ tree type,
+ enum tag_types tag_type,
+ location_t location)
{
cp_token_position start = 0;
if (TYPE_P (type))
error_at (location, "%qT is not a template", type);
else if (TREE_CODE (type) == IDENTIFIER_NODE)
- error_at (location, "%qE is not a template", type);
+ {
+ if (tag_type != none_type)
+ error_at (location, "%qE is not a class template", type);
+ else
+ error_at (location, "%qE is not a template", type);
+ }
else
error_at (location, "invalid template-id");
/* Remember the location of the invalid "<". */
/* There is no valid C++ program where a non-template type is
followed by a "<". That usually indicates that the user thought
that the type was a template. */
- cp_parser_check_for_invalid_template_id (parser, type, token->location);
+ cp_parser_check_for_invalid_template_id (parser, type, none_type,
+ token->location);
return TYPE_NAME (type);
}
followed by a "<". That usually indicates that the user
thought that the type was a template. */
cp_parser_check_for_invalid_template_id (parser, TREE_TYPE (type),
+ none_type,
token->location);
}
/* A "<" cannot follow an elaborated type specifier. If that
happens, the user was probably trying to form a template-id. */
- cp_parser_check_for_invalid_template_id (parser, type, token->location);
+ cp_parser_check_for_invalid_template_id (parser, type, tag_type,
+ token->location);
return type;
}
if (id)
{
cp_parser_check_for_invalid_template_id (parser, id,
+ class_key,
type_start_token->location);
}
virt_specifiers = cp_parser_virt_specifier_seq_opt (parser);