[Bug c/81518] missing warning on a violation of attribute const requirements

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jul 22 22:12:00 GMT 2017


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
I disagree.  A warning would be helpful even in the absence of a definition and
evidence that the function actually access the pointed to data.  A warning
would also be helpful that pointed out that "it does not make sense for a const
function to return void" as the manual states.

Finally, even if the warning shouldn't be issued for declarations without the
evidence that the argument pointer isn't accessed, the warning could be
triggered once a definition were seen that did violate these requirements.


More information about the Gcc-bugs mailing list