https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66748

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think just

--- gcc/cp/tree.c
+++ gcc/cp/tree.c
@@ -3654,13 +3654,15 @@ handle_abi_tag_attribute (tree* node, tree name, tree
args,
                 name, *node);
          goto fail;
        }
-      else if (CLASSTYPE_TEMPLATE_INSTANTIATION (*node))
+      else if (CLASS_TYPE_P (*node)
+              && CLASSTYPE_TEMPLATE_INSTANTIATION (*node))
        {
          warning (OPT_Wattributes, "ignoring %qE attribute applied to "
                   "template instantiation %qT", name, *node);
          goto fail;
        }
-      else if (CLASSTYPE_TEMPLATE_SPECIALIZATION (*node))
+      else if (CLASS_TYPE_P (*node)
+              && CLASSTYPE_TEMPLATE_SPECIALIZATION (*node))
        {
          warning (OPT_Wattributes, "ignoring %qE attribute applied to "
                   "template specialization %qT", name, *node);

should do; testing this.

Reply via email to