From ea663be91a23f217308e669e76b4f0a0c7b86616 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 22 Jun 2015 17:35:34 +0000 Subject: [PATCH] decl.c (grokdeclarator): Use declspecs->locations[ds_virtual]. /cp 2015-06-22 Paolo Carlini * decl.c (grokdeclarator): Use declspecs->locations[ds_virtual]. /testsuite 2015-06-22 Paolo Carlini * g++.dg/inherit/pure1.C: Test location too. 2015-06-22 Paolo Carlini * decl.c (grokdeclarator): Remove pointless code. From-SVN: r224750 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/decl.c | 13 +++---------- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/inherit/pure1.C | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f4e8b21e3d..89e43735a05 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2015-06-22 Paolo Carlini + + * decl.c (grokdeclarator): Use declspecs->locations[ds_virtual]. + +2015-06-22 Paolo Carlini + + * decl.c (grokdeclarator): Remove pointless code. + 2015-06-22 Jason Merrill PR c++/66515 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 515c2d33e10..c934ff93077 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9529,7 +9529,8 @@ grokdeclarator (const cp_declarator *declarator, if (virtualp && (current_class_name == NULL_TREE || decl_context != FIELD)) { - error ("% outside class declaration"); + error_at (declspecs->locations[ds_virtual], + "% outside class declaration"); virtualp = 0; } @@ -10476,19 +10477,11 @@ grokdeclarator (const cp_declarator *declarator, if (decl_context == TYPENAME) { - /* Note that the grammar rejects storage classes - in typenames, fields or parameters. */ - if (type_quals != TYPE_UNQUALIFIED) - type_quals = TYPE_UNQUALIFIED; + /* Note that here we don't care about type_quals. */ /* Special case: "friend class foo" looks like a TYPENAME context. */ if (friendp) { - if (type_quals != TYPE_UNQUALIFIED) - { - error ("type qualifiers specified for friend class declaration"); - type_quals = TYPE_UNQUALIFIED; - } if (inlinep) { error ("% specified for friend class declaration"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f9d26537b4b..60d13270ff3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-06-22 Paolo Carlini + + * g++.dg/inherit/pure1.C: Test location too. + 2015-06-22 Marek Polacek * gcc.dg/fold-ior-1.c: New test. diff --git a/gcc/testsuite/g++.dg/inherit/pure1.C b/gcc/testsuite/g++.dg/inherit/pure1.C index ddd3cb332df..e825f009843 100644 --- a/gcc/testsuite/g++.dg/inherit/pure1.C +++ b/gcc/testsuite/g++.dg/inherit/pure1.C @@ -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" } -- 2.30.2