Commit 0deb916c by Mark Mitchell Committed by Mark Mitchell

re PR c++/15285 (instantiate_type ICE when forming pointer to template function)

	PR c++/15285
	PR c++/15299
	* pt.c (build_non_dependent_expr): Expand the set of tree nodes
	recognized as overloaded functions.

	PR c++/15285
	PR c++/15299
	* g++.dg/template/non-dependent5.C: New test.
	* g++.dg/template/non-dependent6.C: New test.

From-SVN: r82149
parent 52ceb039
2004-05-22 Mark Mitchell <mark@codesourcery.com>
PR c++/15285
PR c++/15299
* pt.c (build_non_dependent_expr): Expand the set of tree nodes
recognized as overloaded functions.
2004-05-22 Mark Mitchell <mark@codesourcery.com>
PR c++/15507
* class.c (layout_nonempty_base_or_field): Do not try to avoid
layout conflicts for unions.
......
......@@ -12158,15 +12158,20 @@ resolve_typename_type (tree type, bool only_current_p)
tree
build_non_dependent_expr (tree expr)
{
tree inner_expr;
/* Preserve null pointer constants so that the type of things like
"p == 0" where "p" is a pointer can be determined. */
if (null_ptr_cst_p (expr))
return expr;
/* Preserve OVERLOADs; the functions must be available to resolve
types. */
if (TREE_CODE (expr) == OVERLOAD
|| TREE_CODE (expr) == FUNCTION_DECL
|| TREE_CODE (expr) == TEMPLATE_DECL)
inner_expr = (TREE_CODE (expr) == ADDR_EXPR ?
TREE_OPERAND (expr, 0) : expr);
if (TREE_CODE (inner_expr) == OVERLOAD
|| TREE_CODE (inner_expr) == FUNCTION_DECL
|| TREE_CODE (inner_expr) == TEMPLATE_DECL
|| TREE_CODE (inner_expr) == TEMPLATE_ID_EXPR)
return expr;
/* Preserve string constants; conversions from string constants to
"char *" are allowed, even though normally a "const char *"
......
2004-05-22 Mark Mitchell <mark@codesourcery.com>
PR c++/15285
PR c++/15299
* g++.dg/template/non-dependent5.C: New test.
* g++.dg/template/non-dependent6.C: New test.
2004-05-22 Mark Mitchell <mark@codesourcery.com>
PR c++/15507
* g++.dg/inherit/union1.C: New test.
......
// PR c++/15299
template <class T> void fun_ptr(T (*)());
template <class T> T bar();
template <class> void foo () {
fun_ptr(bar<int>);
}
// PR c++/15285
void foo(void (*func)()) {}
template<typename T>
void bar()
{}
template<typename T>
void baz()
{
foo(&bar<long>);
}
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