c++: Fix deprecated attribute handling on templates (PR c++/93228)
commitef2e6135591f2a197d4fb8a7dbb8425a9d2df85e
authorJakub Jelinek <jakub@redhat.com>
Fri, 14 Feb 2020 14:39:57 +0000 (14 15:39 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 14 Feb 2020 15:01:46 +0000 (14 16:01 +0100)
tree6f15b1d6761d6389adfc7f71658924681c48f78b
parent04e48115ac4f4eab20525280653e8ff985f1a3d8
c++: Fix deprecated attribute handling on templates (PR c++/93228)

As the following testcase shows, when deprecated attribute is on a template,
we'd never print the message if any, because the attribute is not
present on the TEMPLATE_DECL with which warn_deprecated_use is called,
but on its DECL_TEMPLATE_RESULT or its type.

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.

* g++.dg/cpp1y/attr-deprecated-3.C: New test.
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/attr-deprecated-3.C [new file with mode: 0644]