+2012-02-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/51930
+ * decl.c (check_tag_decl): Move warning for misplaced attributes here.
+ (shadow_tag): From here.
+ * parser.c (cp_parser_explicit_instantiation): Don't warn here.
+
2012-02-21 Jakub Jelinek <jakub@redhat.com>
PR c++/52312
error ("%<constexpr%> cannot be used for type declarations");
}
+ if (declspecs->attributes)
+ {
+ location_t loc = input_location;
+ if (!CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
+ /* For a non-template class, use the name location; for a template
+ class (an explicit instantiation), use the current location. */
+ input_location = location_of (declared_type);
+ warning (0, "attribute ignored in declaration of %q#T", declared_type);
+ warning (0, "attribute for %q#T must follow the %qs keyword",
+ declared_type, class_key_or_enum_as_string (declared_type));
+ input_location = loc;
+ }
+
return declared_type;
}
if (!t)
return NULL_TREE;
- if (declspecs->attributes)
- {
- warning (0, "attribute ignored in declaration of %q+#T", t);
- warning (0, "attribute for %q+#T must follow the %qs keyword",
- t, class_key_or_enum_as_string (t));
-
- }
-
if (maybe_process_partial_specialization (t) == error_mark_node)
return NULL_TREE;
tree type;
type = check_tag_decl (&decl_specifiers);
- if (decl_specifiers.attributes)
- warning (OPT_Wattributes,
- "attributes ignored on explicit type instantiation");
/* Turn access control back on for names used during
template instantiation. */
pop_deferring_access_checks ();