Compiling following code [1] in the following way [2] with gcc 4.3.3 leads to the diagnostics [3].
To my mind statement test.cpp: In constructor 'testclass::testclass()': test.cpp:4: error: class 'testclass' does not have any field named 'number' is redundant because statements test.cpp:15: error: declaration of 'int testclass::number' test.cpp:9: error: conflicts with previous declaration 'int testclass::number() const' that appear before already cover this case. We already have a member named 'number' so we certainly can't have field with the same name. Diagnostic claims that a member 'number' already exist and field with that name cannot be created seems to be more reasonable here, but "test.cpp:15" and "test.cpp:9" already said that. [1] class testclass { public: testclass() : number(4) { } int number() const { return number; } private: int number; }; int main() { testclass ts; (void)ts.number(); return 0; } [2] % gcc -o test test.cpp [3] test.cpp:15: error: declaration of 'int testclass::number' test.cpp:9: error: conflicts with previous declaration 'int testclass::number() const' test.cpp: In constructor 'testclass::testclass()': test.cpp:4: error: class 'testclass' does not have any field named 'number' test.cpp: In member function 'int testclass::number() const': test.cpp:11: error: argument of type 'int (testclass::)()const' does not match 'int' Besides I found it interesting that swapping public: and private: blocks around makes diagnostic even more unclear: test.cpp:14: error: declaration of 'int testclass::number() const' test.cpp:3: error: conflicts with previous declaration 'int testclass::number' test.cpp: In constructor 'testclass::testclass()': test.cpp:6: error: class 'testclass' does not have any field named 'number' test.cpp: In member function 'int testclass::number() const': test.cpp:13: error: argument of type 'int (testclass::)()const' does not match 'int' -- Summary: Redundant diagnostic when class member function's name overlaps with class field's name Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: b0ntrict0r at yandex dot ru GCC build triplet: x86_64-pc-linux-gnu GCC host triplet: x86_64-pc-linux-gnu GCC target triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41002