+1999-05-20 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (for_each_template_parm): Rework to match documentation.
+ Don't be fooled by a COMPONENT_REF with no TREE_TYPE.
+
1999-05-20 Jason Merrill <jason@yorick.cygnus.com>
* class.c (finish_struct_1): Still check for ANON_AGGR_TYPE_P.
(cplus_expand_expr): Here. Use cplus_expand_constant.
(init_cplus_expand): Set lang_expand_constant.
* pt.c (convert_nontype_argument): Use make_ptrmem_cst.
+
* tree.c (make_ptrmem_cst): Define.
* typeck.c (unary_complex_lvalue): Use make_ptrmem_cst.
* typeck2.c (initializer_constant_valid_p): Use make_ptrmem_cst.
switch (TREE_CODE (t))
{
- case INDIRECT_REF:
- case COMPONENT_REF:
- /* We assume that the object must be instantiated in order to build
- the COMPONENT_REF, so we test only whether the type of the
- COMPONENT_REF uses template parms. */
- return for_each_template_parm (TREE_TYPE (t), fn, data);
-
case ARRAY_REF:
case OFFSET_REF:
return (for_each_template_parm (TREE_OPERAND (t, 0), fn, data)
/* NOTREACHED */
return 0;
- case LOOKUP_EXPR:
- case TYPENAME_TYPE:
- return 1;
-
case PTRMEM_CST:
return for_each_template_parm (TREE_TYPE (t), fn, data);
(TREE_TYPE (t)), fn, data);
return for_each_template_parm (TREE_OPERAND (t, 1), fn, data);
+ case SIZEOF_EXPR:
+ case ALIGNOF_EXPR:
+ return for_each_template_parm (TREE_OPERAND (t, 0), fn, data);
+
+ case INDIRECT_REF:
+ case COMPONENT_REF:
+ /* We assume that the object must be instantiated in order to build
+ 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. */
+ if (TREE_TYPE (t))
+ return for_each_template_parm (TREE_TYPE (t), fn, data);
+ /* Fall through. */
+
case MODOP_EXPR:
case CAST_EXPR:
case REINTERPRET_CAST_EXPR:
case ARROW_EXPR:
case DOTSTAR_EXPR:
case TYPEID_EXPR:
- return 1;
-
- case SIZEOF_EXPR:
- case ALIGNOF_EXPR:
- return for_each_template_parm (TREE_OPERAND (t, 0), fn, data);
+ case LOOKUP_EXPR:
+ case TYPENAME_TYPE:
+ if (!fn)
+ return 1;
+ /* Fall through. */
default:
switch (TREE_CODE_CLASS (TREE_CODE (t)))