[Bug c++/123277] [16 Regression] [[maybe_unused]] does not silence Wunused-local-typedefs for dependent typedefs since r16-5937
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jan 2 08:19:09 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123277
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:6dc335c506aca39af537180b2a0b23e640e5346e
commit r16-6462-g6dc335c506aca39af537180b2a0b23e640e5346e
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Jan 2 09:18:02 2026 +0100
c++: Fix up is_late_template_attribute for [[maybe_unused]] [PR123277]
is_late_template_attribute wants to return false for gnu::unused, gnu::used
and maybe_unused attributes, so that -Wunused-local-typedefs sees those
attributes applied even to typedefs to dependent types.
Before my recent r16-5937 change, for maybe_unused this happened to work
through the lookup_attribute_spec returning NULL in that case because
there is no gnu::maybe_unused attribute, but when that has been fixed,
maybe_unused needs to be listed in the exceptions next to unused and used
attributes.
2026-01-02 Jakub Jelinek <jakub@redhat.com>
PR c++/123277
* decl2.cc (is_late_template_attribute): Return false also for
[[maybe_unused]] attribute on TYPE_DECLs to dependent types.
* g++.dg/warn/Wunused-local-typedefs-5.C: New test.
More information about the Gcc-bugs
mailing list