From 4ef3890074446d4ad7dcf60a538ca0c56e887804 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 19 Nov 2018 09:33:18 +0000 Subject: [PATCH] decl2.c (grokfield): Remove obsolete _vptr check; fix explicit template argument list error location. /cp 2018-11-18 Paolo Carlini * decl2.c (grokfield): Remove obsolete _vptr check; fix explicit template argument list error location. /testsuite 2018-11-18 Paolo Carlini * g++.dg/template/crash91.C: Check location too. From-SVN: r266264 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl2.c | 20 +++++--------------- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/template/crash91.C | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6d99d6a5d79..6f60f0d57f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-11-18 Paolo Carlini + + * decl2.c (grokfield): Remove obsolete _vptr check; fix + explicit template argument list error location. + 2018-11-16 Kamlesh Kumar DR 1207 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 04537417129..7686a908631 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -804,7 +804,6 @@ grokfield (const cp_declarator *declarator, tree value; const char *asmspec = 0; int flags; - tree name; if (init && TREE_CODE (init) == TREE_LIST @@ -829,21 +828,12 @@ grokfield (const cp_declarator *declarator, if (value == void_type_node) return value; - - name = DECL_NAME (value); - - if (name != NULL_TREE) + if (DECL_NAME (value) + && TREE_CODE (DECL_NAME (value)) == TEMPLATE_ID_EXPR) { - if (TREE_CODE (name) == TEMPLATE_ID_EXPR) - { - error ("explicit template argument list not allowed"); - return error_mark_node; - } - - if (IDENTIFIER_POINTER (name)[0] == '_' - && id_equal (name, "_vptr")) - error ("member %qD conflicts with virtual function table field name", - value); + error_at (declarator->id_loc, + "explicit template argument list not allowed"); + return error_mark_node; } /* Stash away type declarations. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4db71445888..e1f0ac6b0cc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-11-18 Paolo Carlini + + * g++.dg/template/crash91.C: Check location too. + 2018-11-19 Martin Liska PR gcov-profile/88045 diff --git a/gcc/testsuite/g++.dg/template/crash91.C b/gcc/testsuite/g++.dg/template/crash91.C index 39575cd9f27..6fda320ee95 100644 --- a/gcc/testsuite/g++.dg/template/crash91.C +++ b/gcc/testsuite/g++.dg/template/crash91.C @@ -4,5 +4,5 @@ template void foo(); struct A { - typedef void foo<0>(); // { dg-error "explicit template argument list not allowed" } + typedef void foo<0>(); // { dg-error "16:explicit template argument list not allowed" } }; -- 2.30.2