https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116954
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:b0d7d644f3c25af9bf60c948ab26aa7b09a68787 commit r15-9532-gb0d7d644f3c25af9bf60c948ab26aa7b09a68787 Author: Jason Merrill <ja...@redhat.com> Date: Wed Apr 16 11:15:14 2025 -0400 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.