From: Volker Reichelt Date: Sun, 11 May 2008 19:35:20 +0000 (+0000) Subject: re PR c++/35578 (Error about misplaced 'friend' word is issued on a wrong line) X-Git-Tag: prereleases/gcc-4.2.4-rc1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ffa368db052296d45b8211e3599df39c9a977b2;p=thirdparty%2Fgcc.git re PR c++/35578 (Error about misplaced 'friend' word is issued on a wrong line) PR c++/35578 * parser.c (cp_parser_decl_specifier_seq): Add location to error message. * g++.dg/parse/friend8.C: New test. From-SVN: r135182 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d9687f7ce6d7..9f0c3e34c48b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-05-11 Volker Reichelt + + PR c++/35578 + * parser.c (cp_parser_decl_specifier_seq): Add location to error + message. + 2008-04-17 Volker Reichelt * parser.c (cp_parser_asm_specification_opt): Print CPP_CLOSE_PAREN diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d20087faf269..e8e4c1b0bead 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -7595,7 +7595,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, case RID_FRIEND: if (!at_class_scope_p ()) { - error ("% used outside of class"); + error ("%H% used outside of class", &token->location); cp_lexer_purge_token (parser->lexer); } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd3820e0ef48..b5ddb3870b97 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-11 Volker Reichelt + + PR c++/35578 + * g++.dg/parse/friend8.C: New test. + 2008-05-01 Richard Guenther PR middle-end/36093 diff --git a/gcc/testsuite/g++.dg/parse/friend8.C b/gcc/testsuite/g++.dg/parse/friend8.C new file mode 100644 index 000000000000..aac5f0e55a60 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/friend8.C @@ -0,0 +1,8 @@ +// PR c++/35578 +// Check position of error message +// { dg-do compile } + +int i; + +friend // { dg-error "friend" } + void foo();