C++ PATCH for c++/84221, bogus -Wunused with unused attribute on template

Martin Sebor msebor@gmail.com
Wed Apr 4 20:07:00 GMT 2018


On 04/04/2018 01:58 PM, Jason Merrill wrote:
> 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.

Ah, good!  Thanks for clarifying!  Let me update the bug then
to reflect that.

Martin



More information about the Gcc-patches mailing list