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

Tom Tromey tromey@redhat.com
Sun Mar 30 17:46:00 GMT 2008


>>>>> "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



More information about the Gcc-patches mailing list