Hi,

I think this also qualifies as obvious given the past work / discussion: use in one more place declspecs->locations to improve the location of the error message.

Thanks,
Paolo.

////////////////////////
/cp
2015-06-22  Paolo Carlini  <paolo.carl...@oracle.com>

        * decl.c (grokdeclarator): Use declspecs->locations[ds_virtual].

/testsuite
2015-06-22  Paolo Carlini  <paolo.carl...@oracle.com>

        * g++.dg/inherit/pure1.C: Test location too.
Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 224724)
+++ cp/decl.c   (working copy)
@@ -9529,7 +9529,8 @@ grokdeclarator (const cp_declarator *declarator,
   if (virtualp
       && (current_class_name == NULL_TREE || decl_context != FIELD))
     {
-      error ("%<virtual%> outside class declaration");
+      error_at (declspecs->locations[ds_virtual],
+               "%<virtual%> outside class declaration");
       virtualp = 0;
     }
 
Index: testsuite/g++.dg/inherit/pure1.C
===================================================================
--- testsuite/g++.dg/inherit/pure1.C    (revision 224724)
+++ testsuite/g++.dg/inherit/pure1.C    (working copy)
@@ -3,8 +3,8 @@
 // { dg-do compile }
 
 void foo0() = 0;                   // { dg-error "like a variable" }
-virtual void foo1() = 0;           // { dg-error "outside class|variable" }
-
+virtual void foo1() = 0;           // { dg-error "1:'virtual' outside class" }
+// { dg-error "like a variable" "" { target *-*-* } 6 }
 struct A
 {
   void foo2() = 0;                 // { dg-error "non-virtual" }

Reply via email to