]> 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>
Mon, 28 Apr 2025 20:13:32 +0000 (16:13 -0400)
commit1e91580d64932dffa87831ef403f5fb7a41b6f12
treefd135b936ed36f0aa45d7e7c31bbb58117c5cb36
parent8dce1aa0579ab86a626e24c0af29455f30305595
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.

(cherry picked from commit b0d7d644f3c25af9bf60c948ab26aa7b09a68787)
gcc/cp/contracts.cc
gcc/testsuite/g++.dg/warn/Wformat-3.C [new file with mode: 0644]