[Bug c++/101033] New: Error message for spelling error in copy assignment operator could be improved

hewillk at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 11 15:55:27 GMT 2021


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

            Bug ID: 101033
           Summary: Error message for spelling error in copy assignment
                    operator could be improved
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Consider the following:

https://godbolt.org/z/vfdTq9j3x

class S {
  S& operator=(cont S&);
};

There is a spelling error here, gcc-9 rejects with:

<source>:2:16: error: declaration of 'operator=' as non-function
    2 |   S& operator=(cont S&);
      |                ^~~~

The cursor is accurately positioned on the spelling error, but the error
message of gcc-trunk is:

<source>:2:6: error: declaration of 'operator=' as non-function
    2 |   S& operator=(cont S&);
      |      ^~~~~~~~

which seems to be a bit distracting, and may increase the cost of debugging.


More information about the Gcc-bugs mailing list