This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/84221, bogus -Wunused with unused attribute on template
- From: Jason Merrill <jason at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 4 Apr 2018 15:58:02 -0400
- Subject: Re: C++ PATCH for c++/84221, bogus -Wunused with unused attribute on template
- References: <CADzB+2kSaaW7+q3c19vriBBLY7GJ=ZwSMLQPtvQaNCKGnZC_fw@mail.gmail.com> <b22668ae-a0ed-5560-c481-bfa0674c50f3@gmail.com>
On Wed, Apr 4, 2018 at 3:52 PM, Martin Sebor <msebor@gmail.com> wrote:
> On 04/04/2018 01:04 PM, Jason Merrill wrote:
>>
>> For bugs 54372 and 60063, we changed attributes used and unused to be
>> applied immediately in a template even if what they apply to is
>> dependent, to avoid bogus warnings from
>> maybe_warn_unused_local_typedefs. But that's only an issue for
>> TYPE_DECL, so we can use the normal logic for other things.
>
> In our discussion of attributes I thought we decided that explicit
> specializations would not inherit attributes from the primary.
> IIUC, this change does the opposite for class templates declared
> unused so we end up with an inconsistency with function templates:
I thought about that as well, tested with the explicit specialization
removed, and found that still failed. So that's the bug I fixed.
We do still warn on the testcase from the PR; I should add that to the
testcase I checked in.
Jason