* [C++ Patch] Use declspecs->locations[ds_virtual]
@ 2015-06-22 13:56 Paolo Carlini
2015-06-22 16:56 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2015-06-22 13:56 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
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.
////////////////////////
[-- Attachment #2: CL2 --]
[-- Type: text/plain, Size: 238 bytes --]
/cp
2015-06-22 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grokdeclarator): Use declspecs->locations[ds_virtual].
/testsuite
2015-06-22 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/inherit/pure1.C: Test location too.
[-- Attachment #3: patchlet2 --]
[-- Type: text/plain, Size: 1112 bytes --]
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" }
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ Patch] Use declspecs->locations[ds_virtual]
2015-06-22 13:56 [C++ Patch] Use declspecs->locations[ds_virtual] Paolo Carlini
@ 2015-06-22 16:56 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2015-06-22 16:56 UTC (permalink / raw)
To: Paolo Carlini, gcc-patches
On 06/22/2015 09:54 AM, Paolo Carlini wrote:
> 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.
Agreed, thanks.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-22 16:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22 13:56 [C++ Patch] Use declspecs->locations[ds_virtual] Paolo Carlini
2015-06-22 16:56 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).