OSDN Git Service

/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Sep 2009 23:33:38 +0000 (23:33 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Sep 2009 23:33:38 +0000 (23:33 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151581 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c

index 5746f24..d005077 100644 (file)
@@ -1,7 +1,7 @@
 2009-09-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        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  <howarth@bromo.med.uc.edu>
 
index e57c825..eb48c55 100644 (file)
@@ -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)