This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR c++/35578: Misplaced error message for invalid use of 'friend'


>>>>> "Volker" == Volker Reichelt <v.reichelt@netcologne.de> writes:

Volker> The patch below fixes a diagnostic problem in the C++ parser.
Volker> The error message for invalid usages of `friend' would sometimes
Volker> be in the wrong line. Fixed by adding the location of the keyword
Volker> to the error message.

Volker> +friend void foo(); // { dg-error "friend" }

One suggestion Joseph Myers had for tests like this was to put the
"error location" token on its own line in the test case.  That way we
will ensure that we're emitting the correct location in the future.

Something like:

friend  // { dg-error "friend" }
  void foo();

BTW thanks for looking at this.  Both the C++ parser and a lot of the
C/C++ common code need an error-location audit.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]