[Bug analyzer/98679] Four functions could be marked "const".

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 14 12:36:24 GMT 2021


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-01-14
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to David Binderman from comment #0)
> 1.
> 
> trunk.git/gcc/analyzer/analyzer.h:172:8: style:inconclusive: Technically the
> member function 'ana::region_offset::operator==' can be const.
> [functionConst]

This should absolutely be const. Comparison operators that don't work with
const objects are broken.

> 
> 2.
> 
> trunk.git/gcc/analyzer/pending-diagnostic.h:160:8: style:inconclusive:
> Technically the member function 'ana::pending_diagnostic::equal_p' can be
> const. [functionConst]

The same argument applies here since it's effectively operator==.


More information about the Gcc-bugs mailing list