This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Is a warning for a==a possible?
- From: George Garvey <tmwg-gcc at inxservices dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 4 Dec 2003 05:51:33 -0800
- Subject: Is a warning for a==a possible?
- Organization: inX Services, Los Angeles, CA, USA
Just made a stupid mistake, and wondered if GCC could have warned about it?
struct S {
int A;
bool f(const int a) {
const bool r(A == A);
a = 3;
};
};
The first line in f() should have been r = A == a. No doubt there is a
valid reason to compare something to itself that I can't see right now. Is
it possible for GCC to notice this?