This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is a warning for a==a possible?


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]