@@ -5775,6 +5775,14 @@ check_tag_decl (cp_decl_specifier_seq *d
warn_misplaced_attr_for_class_type (loc, declared_type);
}
+ if (declspecs->std_attributes
+ && declared_type
+ && any_nonignored_attribute_p (declspecs->std_attributes)
+ && warning_at (declspecs->locations[ds_std_attribute], OPT_Wattributes,
+ "attribute ignored"))
+ inform (declspecs->locations[ds_std_attribute],
+ "an attribute that appertains to a type-specifier is ignored");
+
/* Diagnose invalid application of contracts, if any. */
if (find_contract (declspecs->attributes))
diagnose_misapplied_contracts (declspecs->attributes);
@@ -0,0 +1,8 @@
+// { dg-do compile { target c++11 } }
+
+struct S {};
+struct S [[gnu::deprecated]]; // { dg-warning "attribute ignored" }
+// { dg-message "an attribute that appertains to a type-specifier is ignored" "" { target *-*-* } .-1 }
+enum E {};
+enum E [[gnu::deprecated]]; // { dg-warning "attribute ignored" }
+// { dg-message "an attribute that appertains to a type-specifier is ignored" "" { target *-*-* } .-1 }