https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116767
--- Comment #11 from Raffaello Bertini <raffaellobertini at gmail dot com> --- > MyFunc __attribute__((const)) * g_f = my_func; > instead. Just with the attribute syntax you get an extra warning: > warning: ‘const’ attribute on function returning ‘void’ [-Wattributes] That's fine for me. even as it is now. I was just writing that would be a little more user-friendly if the warning would be also reported when using the keyword const and not only with the attribute. As i understood also that keyword is converted as attribute, gcc should be able to generate that warning too. > But if the function returned anything but int, That's true if returning int the code will be generated it is only on the const void func ptr situation. .