* decl2.c (is_late_template_attribute): Return false for "used".
From-SVN: r249347
2017-06-17 Jason Merrill <jason@redhat.com>
+ PR c++/60063 - -Wunused-local-typedefs and templates.
+ * decl2.c (is_late_template_attribute): Return false for "used".
+
PR c++/70844 - -Wuseless-cast and inheriting constructor.
* method.c (forward_parm): Suppress warn_useless_cast.
if (is_attribute_p ("weak", name))
return true;
- /* Attribute unused is applied directly, as it appertains to
+ /* Attributes used and unused are applied directly, as they appertain to
decls. */
- if (is_attribute_p ("unused", name))
+ if (is_attribute_p ("unused", name)
+ || is_attribute_p ("used", name))
return false;
/* Attribute tls_model wants to modify the symtab. */
--- /dev/null
+// PR c++/60063
+// { dg-options -Wunused-local-typedefs }
+
+template <class> struct S;
+
+void foo (int i) {
+ typedef __attribute__ ((used)) S<int> X;
+}
+
+template <class T>
+void bar (T i) {
+ typedef __attribute__ ((used)) S<T> Y;
+}