+2020-01-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2020-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/93228
+ * parser.c (cp_parser_template_name): Look up deprecated attribute
+ in DECL_TEMPLATE_RESULT or its type's attributes.
+
2020-01-22 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
{
if (TREE_DEPRECATED (decl)
&& deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (decl, NULL_TREE);
+ {
+ tree d = DECL_TEMPLATE_RESULT (decl);
+ tree attr;
+ if (TREE_CODE (d) == TYPE_DECL)
+ attr = lookup_attribute ("deprecated",
+ TYPE_ATTRIBUTES (TREE_TYPE (d)));
+ else
+ attr = lookup_attribute ("deprecated",
+ DECL_ATTRIBUTES (d));
+ warn_deprecated_use (decl, attr);
+ }
}
else
{
+2020-01-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2020-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/93228
+ * g++.dg/cpp1y/attr-deprecated-3.C: New test.
+
2020-01-22 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
--- /dev/null
+// PR c++/93228
+// { dg-do compile { target c++14 } }
+
+template <typename T>
+struct [[deprecated("foo")]] bar {}; // { dg-message "declared here" }
+struct [[deprecated("baz")]] qux {}; // { dg-message "declared here" }
+
+void
+quux ()
+{
+ bar<int> b; // { dg-warning "is deprecated: foo" }
+ qux c; // { dg-warning "is deprecated: baz" }
+}