int operator-(foo a, foo b) {} struct bar { int operator-(foo a, foo b) {} };
gets you: ~/ootbc/members/src$ g++ foo.cc foo.cc:1: error: declaration of `operator-' as non-function foo.cc:1: error: `foo' was not declared in this scope foo.cc:1: error: `foo' was not declared in this scope foo.cc:1: error: expected `,' or `;' before '{' token foo.cc:4: error: declaration of `operator-' as non-function foo.cc:4: error: expected `;' before '(' token foo.cc:5: error: expected `;' before '}' token The undeclared names are not reported in the member function, and both produce cascaded diagnostics. -- Summary: poor diagnostics Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24567