Commit 588c2d1c by Mark Mitchell Committed by Mark Mitchell

pt.c (for_each_template_parm): Don't examine uninstantiated default arguments.

	* pt.c (for_each_template_parm): Don't examine uninstantiated
	default arguments.

From-SVN: r23137
parent cc482456
1998-10-16 Mark Mitchell <mark@markmitchell.com>
* pt.c (for_each_template_parm): Don't examine uninstantiated
default arguments.
1998-10-16 Dave Brolley <brolley@cygnus.com>
* lex.c (real_yylex): Fix unaligned access of wchar_t.
......
......@@ -3766,10 +3766,29 @@ for_each_template_parm (t, fn, data)
return for_each_template_parm (TREE_VALUE
(TYPE_TEMPLATE_INFO (t)),
fn, data);
case FUNCTION_TYPE:
if (for_each_template_parm (TYPE_ARG_TYPES (t), fn, data))
case METHOD_TYPE:
if (for_each_template_parm (TYPE_METHOD_BASETYPE (t), fn, data))
return 1;
/* Fall through. */
case FUNCTION_TYPE:
/* Check the parameter types. Since default arguments are not
instantiated until they are needed, the TYPE_ARG_TYPES may
contain expressions that involve template parameters. But,
no-one should be looking at them yet. And, once they're
instantiated, they don't contain template parameters, so
there's no point in looking at them then, either. */
{
tree parm;
for (parm = TYPE_ARG_TYPES (t); parm; parm = TREE_CHAIN (parm))
if (for_each_template_parm (TREE_VALUE (parm), fn, data))
return 1;
}
/* Check the return type, too. */
return for_each_template_parm (TREE_TYPE (t), fn, data);
case ARRAY_TYPE:
if (for_each_template_parm (TYPE_DOMAIN (t), fn, data))
return 1;
......@@ -3778,12 +3797,6 @@ for_each_template_parm (t, fn, data)
if (for_each_template_parm (TYPE_OFFSET_BASETYPE (t), fn, data))
return 1;
return for_each_template_parm (TREE_TYPE (t), fn, data);
case METHOD_TYPE:
if (for_each_template_parm (TYPE_METHOD_BASETYPE (t), fn, data))
return 1;
if (for_each_template_parm (TYPE_ARG_TYPES (t), fn, data))
return 1;
return for_each_template_parm (TREE_TYPE (t), fn, data);
/* decl nodes */
case TYPE_DECL:
......
// Build don't link:
template <int dim>
class Point {
public:
Point (Point<dim> &);
Point<dim> & operator = (Point<dim> &);
};
template <int dim>
class bar{
public:
void foo (Point<dim> p = Point<dim>());
};
template <>
void bar<2>::foo (Point<2> p) {
const int dim = 2;
Point<dim> q = p;
};
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