summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-11 19:35:20 +0000
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-11 19:35:20 +0000
commit782a6d89159bb97771f4e4e3f8c087528f7e913e (patch)
tree6d659a654136de38381533a42ed9fc2d72e76381
parent19f11147a2d556dabe174f530beb4a45a0c565d7 (diff)
downloadgcc-782a6d89159bb97771f4e4e3f8c087528f7e913e.tar.gz
PR c++/35578
* 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/branches/gcc-4_2-branch@135182 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/friend8.C8
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d9687f7ce6d..9f0c3e34c48 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d20087faf26..e8e4c1b0bea 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 ("%<friend%> used outside of class");
+ error ("%H%<friend%> used outside of class", &token->location);
cp_lexer_purge_token (parser->lexer);
}
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fd3820e0ef4..b5ddb3870b9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..aac5f0e55a6
--- /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();