Commit 4699c561 by Mark Mitchell Committed by Mark Mitchell

pt.c (for_each_template_parm): Walk into TYPENAME_TYPEs, INDIRECT_REFs, and COMPONENT_REFs.

	* pt.c (for_each_template_parm): Walk into TYPENAME_TYPEs,
	INDIRECT_REFs, and COMPONENT_REFs.  Handle FIELD_DECLs.

From-SVN: r27108
parent ba50acac
1999-05-22 Mark Mitchell <mark@codesourcery.com> 1999-05-22 Mark Mitchell <mark@codesourcery.com>
* pt.c (for_each_template_parm): Walk into TYPENAME_TYPEs,
INDIRECT_REFs, and COMPONENT_REFs. Handle FIELD_DECLs.
* cp-tree.h (push_nested_namespace): Declare. * cp-tree.h (push_nested_namespace): Declare.
(pop_nested_namespace): Likewise. (pop_nested_namespace): Likewise.
* decl.c (push_nested_namespace): New function. * decl.c (push_nested_namespace): New function.
......
...@@ -4117,7 +4117,6 @@ for_each_template_parm (t, fn, data) ...@@ -4117,7 +4117,6 @@ for_each_template_parm (t, fn, data)
case FUNCTION_DECL: case FUNCTION_DECL:
case VAR_DECL: case VAR_DECL:
/* ??? What about FIELD_DECLs? */
if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t) if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t)
&& for_each_template_parm (DECL_TI_ARGS (t), fn, data)) && for_each_template_parm (DECL_TI_ARGS (t), fn, data))
return 1; return 1;
...@@ -4162,6 +4161,7 @@ for_each_template_parm (t, fn, data) ...@@ -4162,6 +4161,7 @@ for_each_template_parm (t, fn, data)
case VOID_TYPE: case VOID_TYPE:
case BOOLEAN_TYPE: case BOOLEAN_TYPE:
case NAMESPACE_DECL: case NAMESPACE_DECL:
case FIELD_DECL:
return 0; return 0;
/* constants */ /* constants */
...@@ -4192,16 +4192,24 @@ for_each_template_parm (t, fn, data) ...@@ -4192,16 +4192,24 @@ for_each_template_parm (t, fn, data)
case ALIGNOF_EXPR: case ALIGNOF_EXPR:
return for_each_template_parm (TREE_OPERAND (t, 0), fn, data); return for_each_template_parm (TREE_OPERAND (t, 0), fn, data);
case TYPENAME_TYPE:
if (!fn)
return 1;
return (for_each_template_parm (TYPE_CONTEXT (t), fn, data)
|| for_each_template_parm (TYPENAME_TYPE_FULLNAME (t),
fn, data));
case INDIRECT_REF: case INDIRECT_REF:
case COMPONENT_REF: case COMPONENT_REF:
/* We assume that the object must be instantiated in order to build /* If there's no type, then this thing must be some expression
the COMPONENT_REF, so we test only whether the type of the
COMPONENT_REF uses template parms. On the other hand, if
there's no type, then this thing must be some expression
involving template parameters. */ involving template parameters. */
if (TREE_TYPE (t)) if (!fn && !TREE_TYPE (t))
return for_each_template_parm (TREE_TYPE (t), fn, data); return 1;
/* Fall through. */ if (TREE_CODE (t) == COMPONENT_REF)
return (for_each_template_parm (TREE_OPERAND (t, 0), fn, data)
|| for_each_template_parm (TREE_OPERAND (t, 1), fn, data));
else
return for_each_template_parm (TREE_OPERAND (t, 0), fn, data);
case MODOP_EXPR: case MODOP_EXPR:
case CAST_EXPR: case CAST_EXPR:
...@@ -4213,7 +4221,6 @@ for_each_template_parm (t, fn, data) ...@@ -4213,7 +4221,6 @@ for_each_template_parm (t, fn, data)
case DOTSTAR_EXPR: case DOTSTAR_EXPR:
case TYPEID_EXPR: case TYPEID_EXPR:
case LOOKUP_EXPR: case LOOKUP_EXPR:
case TYPENAME_TYPE:
if (!fn) if (!fn)
return 1; return 1;
/* Fall through. */ /* Fall through. */
......
// Build don't link:
// Origin: Raja R Harinath <harinath@cs.umn.edu>
template<class T1, class T2> class foo;
template<class T> struct foo<T,typename T::bar>;
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