@@ -4219,7 +4219,8 @@ check_tag_decl (cp_decl_specifier_seq *d
if (declspecs->attributes && warn_attributes)
{
location_t loc;
- if (!CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
+ if (!CLASS_TYPE_P (declared_type)
+ || !CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
/* For a non-template class, use the name location. */
loc = location_of (declared_type);
else
@@ -0,0 +1,4 @@
+// PR c++/52671
+// { dg-do compile }
+__attribute__ ((deprecated)) enum E { E0 }; // { dg-warning "attribute ignored in declaration of" }
+// { dg-message "must follow the" "" { target *-*-* } 3 }