Commit b03a08ee by Mark Mitchell Committed by Mark Mitchell

init.c (build_member_call): Handle template-id expressions correctly.

	* init.c (build_member_call): Handle template-id expressions
	correctly.
	* typeck.c (build_x_function_call): Likewise.

From-SVN: r25859
parent 91813b28
1999-03-19 Mark Mitchell <mark@codesourcery.com>
* init.c (build_member_call): Handle template-id expressions
correctly.
* typeck.c (build_x_function_call): Likewise.
1999-03-19 Chip Salzenberg <chip@perlsupport.com>
* friend.c (make_friend_class): Avoid core dump when
......
......@@ -1381,7 +1381,11 @@ build_member_call (type, name, parmlist)
if (TREE_CODE (name) != TEMPLATE_ID_EXPR)
method_name = name;
else
method_name = TREE_OPERAND (name, 0);
{
method_name = TREE_OPERAND (name, 0);
if (is_overloaded_fn (method_name))
method_name = DECL_NAME (OVL_CURRENT (method_name));
}
if (TREE_CODE (method_name) == BIT_NOT_EXPR)
{
......
......@@ -2585,6 +2585,15 @@ build_x_function_call (function, params, decl)
TYPE_BINFO (type), LOOKUP_NORMAL);
}
if ((TREE_CODE (function) == FUNCTION_DECL
&& DECL_STATIC_FUNCTION_P (function))
|| (TREE_CODE (function) == TEMPLATE_DECL
&& DECL_STATIC_FUNCTION_P (DECL_RESULT (function))))
return build_member_call(DECL_CONTEXT (function),
template_id
? template_id : DECL_NAME (function),
params);
is_method = ((TREE_CODE (function) == TREE_LIST
&& current_class_type != NULL_TREE
&& (IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (function))
......@@ -2593,13 +2602,6 @@ build_x_function_call (function, params, decl)
|| TREE_CODE (type) == METHOD_TYPE
|| TYPE_PTRMEMFUNC_P (type));
if ((TREE_CODE (function) == FUNCTION_DECL
&& DECL_STATIC_FUNCTION_P (function))
|| (TREE_CODE (function) == TEMPLATE_DECL
&& DECL_STATIC_FUNCTION_P (DECL_RESULT (function))))
return build_member_call
(DECL_CONTEXT (function), DECL_NAME (function), params);
/* A friend template. Make it look like a toplevel declaration. */
if (! is_method && TREE_CODE (function) == TEMPLATE_DECL)
function = scratch_ovl_cons (function, NULL_TREE);
......
// Build don't link:
// Origin: Corey Kosak
struct cow_t {
template<bool Q>
static void tfunc(cow_t *cowp) {}
void moo() {
cow_t *cowp;
cow_t::tfunc<true>(cowp);
}
};
int main()
{
cow_t *cowp;
cow_t::tfunc<true>(cowp);
}
// Build don't link:
// excess errors test - XFAIL *-*-*
// excess errors test
struct foo {
template<typename T> T bar() { return staticbar<T>( this ); }
......
// Build don't link:
// Origin: Corey Kosak <kosak@cs.cmu.edu>
struct cow_t {
template<bool Q>
static void tfunc(cow_t *cowp) {}
void moo() {
cow_t *cowp;
tfunc<true>(cowp);
}
};
int main()
{
cow_t *cowp;
cow_t::tfunc<true>(cowp);
}
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