aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2009-09-09 23:33:38 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2009-09-09 23:33:38 +0000
commit3937f036d74facab7f027f20716cf2813c4029af (patch)
tree1ad4d74864ead4f7a38441b92d74909d42abcbba /gcc/cp/decl2.c
parente7e5ba098425d3d3a569d36539a977f40ca5c797 (diff)
downloadgcc-3937f036d74facab7f027f20716cf2813c4029af.zip
gcc-3937f036d74facab7f027f20716cf2813c4029af.tar.gz
gcc-3937f036d74facab7f027f20716cf2813c4029af.tar.bz2
re PR c++/28293 (ICE on invalid typedef)
/cp 2009-09-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/28293 * decl2.c (grokfield): Check for explicit template argument lists. /testsuite 2009-09-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/28293 * g++.dg/template/crash91.C: New. From-SVN: r151581
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c21
1 files changed, 16 insertions, 5 deletions
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)