]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/35578 (Error about misplaced 'friend' word is issued on a wrong line)
authorVolker Reichelt <v.reichelt@netcologne.de>
Sun, 11 May 2008 19:35:20 +0000 (19:35 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Sun, 11 May 2008 19:35:20 +0000 (19:35 +0000)
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

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/friend8.C [new file with mode: 0644]

index d9687f7ce6d75713c3ca800b10df6e71bcef7ac8..9f0c3e34c48b138418d678b774e7c52ef46a04cd 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-11  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c++/35578
+       * parser.c (cp_parser_decl_specifier_seq): Add location to error
+       message.
+
 2008-04-17  Volker Reichelt  <v.reichelt@netcologne.de>
 
        * parser.c (cp_parser_asm_specification_opt): Print CPP_CLOSE_PAREN
index d20087faf269b4727031ad423f0e54247f2bfa24..e8e4c1b0bead6785f733c234d6bd33ad516db59c 100644 (file)
@@ -7595,7 +7595,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
        case RID_FRIEND:
          if (!at_class_scope_p ())
            {
-             error ("%<friend%> used outside of class");
+             error ("%H%<friend%> used outside of class", &token->location);
              cp_lexer_purge_token (parser->lexer);
            }
          else
index fd3820e0ef4877057fd09e868cd393acb8112b4b..b5ddb3870b97b1ca525d579c73fae37b9fa0406a 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-11  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c++/35578
+       * g++.dg/parse/friend8.C: New test.
+
 2008-05-01  Richard Guenther  <rguenther@suse.de>
 
        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 (file)
index 0000000..aac5f0e
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/35578
+// Check position of error message
+// { dg-do compile }
+
+int i;
+
+friend  // { dg-error "friend" }
+  void foo();