https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112267
--- Comment #1 from Fabio Alemagna <falemagn at gmail dot com> --- Changing the return type of the function func() from int to auto makes the warning disappear. Incidentally it causes an error on clang, though, which prompts the question: is this a clang bug, for erroring out, or a gcc bug, for not erroring out? See it on Compiler Explorer: https://godbolt.org/z/4ETs4ca3d