diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2df3398..5ec6589 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12590,6 +12590,20 @@ lookup_and_check_tag (enum tag_types tag_code, tree name, decl, template_header_p | DECL_SELF_REFERENCE_P (decl)); + if (template_header_p && t && CLASS_TYPE_P (t) + && (!CLASSTYPE_TEMPLATE_INFO (t) + || (!PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t))))) + { + error ("%qT is not a template", t); + inform (location_of (t), "previous declaration here"); + if (TYPE_CLASS_SCOPE_P (t) + && CLASSTYPE_TEMPLATE_INFO (TYPE_CONTEXT (t))) + inform (input_location, + "perhaps you want to explicitly add %<%T::%>", + TYPE_CONTEXT (t)); + t = error_mark_node; + } + return t; } else if (decl && TREE_CODE (decl) == TREE_LIST) |