Quote:It's correct behvaior, but obviously not what you wanted. What it's actually doing is comparing the function istelf (a pointer to that function) to zero.
A valiant attempt, but this is not the case here. Forming a pointer-to-member would be required to compare the function's address to zero, and that requires explicit use of the address-of operator and a slightly different syntax in general.
To the OP, there is more to your problem then you have extracted and shown here.
The following code, identical to yours but for the creation of a main() function to hold the offending code, produces error C3867 (complaining that Width() is missing a function call argument list) as expected:
#include <iostream>class TestClass{public: TestClass(){m_Width = 0;} ~TestClass(){} unsigned int Width(){ return m_Width; } void Width(unsigned int width){ m_Width = width; }private: unsigned int m_Width;};int main(){ TestClass object; if (object.Width > 0) { std::cout << "TRUE"; } else { std::cout << "FALSE"; }}
Perhaps you have a macro in scope that is doing something funky? Try to pare down the example further.