]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: format attribute redeclaration [PR116954]
authorJason Merrill <jason@redhat.com>
Wed, 16 Apr 2025 15:15:14 +0000 (11:15 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 16 Apr 2025 18:48:35 +0000 (14:48 -0400)
commitb0d7d644f3c25af9bf60c948ab26aa7b09a68787
tree2f26ad016a180f5a55fdadb16fdff8173cd1b8e3
parent6b4569a3ebdd0df44d87d67a18272ec0b878f2ee
c++: format attribute redeclaration [PR116954]

Here when merging the two decls, remove_contract_attributes loses
ATTR_IS_DEPENDENT on the format attribute, so apply_late_template_attributes
just returns, so the attribute doesn't get propagated to the type where the
warning looks for it.

Fixed by using copy_node instead of tree_cons to preserve flags.

PR c++/116954

gcc/cp/ChangeLog:

* contracts.cc (remove_contract_attributes): Preserve flags
on the attribute list.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wformat-3.C: New test.
gcc/cp/contracts.cc
gcc/testsuite/g++.dg/warn/Wformat-3.C [new file with mode: 0644]