aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2021-12-16 15:11:45 -0700
committerMartin Sebor <msebor@redhat.com>2021-12-16 15:11:45 -0700
commit93faac7e32e4f9503c559f2a3e5a4732f5e9ea09 (patch)
tree818d8af4159d0ded45bcfe09155eb2a0098c42a1 /gcc/cp/parser.c
parentf91814c22595e1db642140efe030caf2c092ab6f (diff)
downloadgcc-93faac7e32e4f9503c559f2a3e5a4732f5e9ea09.zip
gcc-93faac7e32e4f9503c559f2a3e5a4732f5e9ea09.tar.gz
gcc-93faac7e32e4f9503c559f2a3e5a4732f5e9ea09.tar.bz2
Check for class type before assuming a type is one [PR103703].
Resolves: PR c++/103703 - ICE with -Wmismatched-tags with friends and templates gcc/cp/ChangeLog: PR c++/103703 * parser.c (class_decl_loc_t::diag_mismatched_tags): Check for class type before assuming a type is one. gcc/testsuite/ChangeLog: PR c++/103703 * g++.dg/warn/Wmismatched-tags-9.C: New test.
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 5d72201..9cf7435 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -33527,7 +33527,7 @@ class_decl_loc_t::diag_mismatched_tags (tree type_decl)
class_decl_loc_t *cdlguide = this;
tree type = TREE_TYPE (type_decl);
- if (CLASSTYPE_IMPLICIT_INSTANTIATION (type))
+ if (CLASS_TYPE_P (type) && CLASSTYPE_IMPLICIT_INSTANTIATION (type))
{
/* For implicit instantiations of a primary template look up
the primary or partial specialization and use it as