https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119191

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
EDG is almost there:

"callop.cc", line 2: error: an operator name must be declared as a function
    void operator();
         ^

"callop.cc", line 3: error: expected an operator
    void operator(int);
                 ^

"callop.cc", line 7: error: an operator name must be declared as a function
    void operator() { }
         ^

"callop.cc", line 7: error: expected a ";"
    void operator() { }
                    ^

"callop.cc", line 12: error: an operator name must be declared as a function
    void operator() const;
         ^

"callop.cc", line 12: error: expected a ";"
    void operator() const;
                    ^

"callop.cc", line 13: error: expected an operator
    void operator(int) const;
                 ^

7 errors detected in the compilation of "callop.cc".


For the first one, "an operator name must be declared as a function" is
correctly saying that 'operator()' is an operator name, and so it must be
declared as a function, i.e. with a parameter list. That's technically correct,
and not just "that's wrong", but could use more user-friendly wording.

And for the second one, "expected an operator" for 'operator(int)' is saying
that it excpected an operator before the parameter list, e.g. 'operator++' or
'operator()'. Again, technically correct, but could be more user-friendly.

Reply via email to