[Bug c++/89882] New: [8/9 Regression] Extra caret marker when issuing diagnostics for the "'friend' used outside of class" error

asolokha at gmx dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 29 09:20:00 GMT 2019


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

            Bug ID: 89882
           Summary: [8/9 Regression] Extra caret marker when issuing
                    diagnostics for the "'friend' used outside of class"
                    error
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc 9 and 8 emit what I believe is a superfluous marker when issuing a
diagnostic for the following invalid code:

friend void
foo ();

% g++-9.0.0-alpha20190324 -fsyntax-only ehvo8syg.cc 
ehvo8syg.cc:1:1: error: 'friend' used outside of class
    1 | friend void
      | ^~~~~~
      | ------

Or is the second line of dashes meant to give a cue that the marked substring
have to be simply removed? If so, it is seemingly inconsistent, as there's no
such lines for other invalid specifiers in the following example:

friend virtual void
foo () override;

% g++-9.0.0-alpha20190324 -fsyntax-only ehvo8syg.cc
ehvo8syg.cc:1:1: error: 'friend' used outside of class
    1 | friend virtual void
      | ^~~~~~
      | ------
ehvo8syg.cc:1:8: error: 'virtual' outside class declaration
    1 | friend virtual void
      |        ^~~~~~~
ehvo8syg.cc:2:8: error: virt-specifiers in 'foo' not allowed outside a class
definition
    2 | foo () override;
      |        ^~~~~~~~


More information about the Gcc-bugs mailing list