https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119528
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- You obviously need to declare the free function first, but without deprecated attribute and just add that attribute afterwards when you'll no longer use it in your code. That isn't any different from using it e.g. in some inline function which will be then deprecated as well etc.