OSDN Git Service

PR c++/35578
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 30 Mar 2008 22:02:06 +0000 (22:02 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 30 Mar 2008 22:02:06 +0000 (22:02 +0000)
* parser.c (cp_parser_decl_specifier_seq): Add location to error
message.

* g++.dg/parse/friend8.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133738 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9627a53..ac3deb4 100644 (file)
@@ -1,3 +1,9 @@
+2008-03-30  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c++/35578
+       * parser.c (cp_parser_decl_specifier_seq): Add location to error
+       message.
+
 2008-03-27  Tom Tromey  <tromey@redhat.com>
 
        * Make-lang.in: Revert automatic dependency patch.
index 35a2fc3..bb16edf 100644 (file)
@@ -8103,7 +8103,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 e7e4b30..515f5fd 100644 (file)
@@ -1,5 +1,8 @@
 2008-03-30  Volker Reichelt  <v.reichelt@netcologne.de>
 
+       PR c++/35578
+       * g++.dg/parse/friend8.C: New test.
+
        PR c/35748
        * gcc.dg/union-cast-4.c: New test.
 
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();