https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119191
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Clang is no better, it also just says "that's wrong" without a fix-it:
callop.cc:2:8: error: 'operator()' cannot be the name of a variable or data
member
2 | void operator();
| ^
callop.cc:3:17: error: expected ')'
3 | void operator(int);
| ^
callop.cc:3:16: note: to match this '('
3 | void operator(int);
| ^
callop.cc:3:8: error: 'operator()' cannot be the name of a variable or data
member
3 | void operator(int);
| ^
callop.cc:7:8: error: 'operator()' cannot be the name of a variable or data
member
7 | void operator() { }
| ^
callop.cc:7:22: error: expected ';' at end of declaration list
7 | void operator() { }
| ^
| ;
callop.cc:12:8: error: 'operator()' cannot be the name of a variable or data
member
12 | void operator() const;
| ^
callop.cc:12:18: error: expected ';' at end of declaration list
12 | void operator() const;
| ^
| ;
callop.cc:13:17: error: expected ')'
13 | void operator(int) const;
| ^
callop.cc:13:16: note: to match this '('
13 | void operator(int) const;
| ^
callop.cc:13:8: error: 'operator()' cannot be the name of a variable or data
member
13 | void operator(int) const;
| ^
callop.cc:13:21: error: expected ';' at end of declaration list
13 | void operator(int) const;
| ^
| ;
10 errors generated.