diff options
author | Jason Merrill <jason@redhat.com> | 2016-02-24 14:56:09 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-02-24 14:56:09 -0500 |
commit | 944e9f5feea2ef45badd508d639f2b5802f3824d (patch) | |
tree | ae495e7ade17d9b968493c2f5505766ce0eb7d33 /gcc/cp/decl.c | |
parent | b8599b68edc1626c905752d56b6c9b99ac89f126 (diff) | |
download | gcc-944e9f5feea2ef45badd508d639f2b5802f3824d.zip gcc-944e9f5feea2ef45badd508d639f2b5802f3824d.tar.gz gcc-944e9f5feea2ef45badd508d639f2b5802f3824d.tar.bz2 |
PR c++/69323 - errors
* friend.c (make_friend_class): Likewise.
* decl.c (lookup_and_check_tag): Diagnose invalid dependent friend.
From-SVN: r233682
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) |