From: Paolo Carlini Date: Mon, 22 Jun 2015 17:35:34 +0000 (+0000) Subject: decl.c (grokdeclarator): Use declspecs->locations[ds_virtual]. X-Git-Tag: basepoints/gcc-7~6189 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea663be91a23f217308e669e76b4f0a0c7b86616;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f4e8b21e3d2..89e43735a05a 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 515c2d33e10d..c934ff930779 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 f9d26537b4b6..60d13270ff38 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 ddd3cb332dfd..e825f0098433 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" }