[Bug c/83559] [8 regression] -Wsuggest-attribute=const conflicts with -Wattributes warning about const attribute on function returning void

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 6 01:37:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83559

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
The GCC manual says that "It does not make sense for a const function to return
void" so I would tend to think of the suggestion as a bug.  With that, I would
recommend either disabling -Wsuggest-attribute=const when the definition of the
function is being compiled by an older version of GCC, or conditionally adding
a const declaration of the void function into the source file (not the header)
just for the older compilers.


More information about the Gcc-bugs mailing list