From b05fa8368e30054d5d8d44011270935ebe402d61 Mon Sep 17 00:00:00 2001 From: paolo Date: Wed, 9 Sep 2009 23:33:38 +0000 Subject: [PATCH] /cp 2009-09-09 Paolo Carlini PR c++/28293 * decl2.c (grokfield): Check for explicit template argument lists. /testsuite 2009-09-09 Paolo Carlini PR c++/28293 * g++.dg/template/crash91.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151581 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 2 +- gcc/cp/decl2.c | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5746f24..d005077 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,7 +1,7 @@ 2009-09-09 Paolo Carlini PR c++/28293 - * decl.c (grokfield): Check for explicit template argument lists. + * decl2.c (grokfield): Check for explicit template argument lists. 2009-09-09 Jack Howarth diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index e57c825..eb48c55 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -764,6 +764,7 @@ grokfield (const cp_declarator *declarator, tree value; const char *asmspec = 0; int flags = LOOKUP_ONLYCONVERTING; + tree name; if (init && TREE_CODE (init) == TREE_LIST @@ -792,11 +793,21 @@ grokfield (const cp_declarator *declarator, && DECL_CONTEXT (value) != current_class_type) return value; - if (DECL_NAME (value) != NULL_TREE - && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_' - && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr")) - error ("member %qD conflicts with virtual function table field name", - value); + name = DECL_NAME (value); + + if (name != NULL_TREE) + { + if (TREE_CODE (name) == TEMPLATE_ID_EXPR) + { + error ("explicit template argument list not allowed"); + return error_mark_node; + } + + if (IDENTIFIER_POINTER (name)[0] == '_' + && ! strcmp (IDENTIFIER_POINTER (name), "_vptr")) + error ("member %qD conflicts with virtual function table field name", + value); + } /* Stash away type declarations. */ if (TREE_CODE (value) == TYPE_DECL) -- 2.7.4