Commit 3937f036 by Paolo Carlini Committed by Paolo Carlini

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
parent e7e5ba09
2009-09-09 Paolo Carlini <paolo.carlini@oracle.com> 2009-09-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/28293 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> 2009-09-09 Jack Howarth <howarth@bromo.med.uc.edu>
......
...@@ -764,6 +764,7 @@ grokfield (const cp_declarator *declarator, ...@@ -764,6 +764,7 @@ grokfield (const cp_declarator *declarator,
tree value; tree value;
const char *asmspec = 0; const char *asmspec = 0;
int flags = LOOKUP_ONLYCONVERTING; int flags = LOOKUP_ONLYCONVERTING;
tree name;
if (init if (init
&& TREE_CODE (init) == TREE_LIST && TREE_CODE (init) == TREE_LIST
...@@ -792,11 +793,21 @@ grokfield (const cp_declarator *declarator, ...@@ -792,11 +793,21 @@ grokfield (const cp_declarator *declarator,
&& DECL_CONTEXT (value) != current_class_type) && DECL_CONTEXT (value) != current_class_type)
return value; return value;
if (DECL_NAME (value) != NULL_TREE name = DECL_NAME (value);
&& IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
&& ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr")) if (name != NULL_TREE)
error ("member %qD conflicts with virtual function table field name", {
value); 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. */ /* Stash away type declarations. */
if (TREE_CODE (value) == TYPE_DECL) if (TREE_CODE (value) == TYPE_DECL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment