Commit 4393e105 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (tsubst): Change prototype.

	* cp-tree.h (tsubst): Change prototype.
	(tsubst_expr): Likewise.
	(tsubst_copy): Likewise.
	(type_unification): Remove prototype.
	* call.c (convert_default_arg): Adjust call to tsubst_expr.
	* class.c (resolve_address_of_overloaded_function): Just use
	fn_type_unification.
	* decl.c (grokdeclarator): Adjust call to tsubst.
	* method.c (build_template_parm_names): Likewise.
	* pt.c (GTB_VIA_VIRTUAL): New macro.
	(GTB_IGNORE_TYPE): Likewise.
	(resolve_overloaded_unification): Add `complain' parameter.
	(try_one_overload): Likewise.
	(tsubst_template_arg_vector): Likewise.
	(tsubst_template_parms): Likewise.
	(tsubst_aggr_type): Likewise.
	(tsubst_arg_types): Likewise.
	(tsubst_call_declarator_parms): Likewise.
	(unify): Remove explicit_mask.
	(type_unification_real): Likewise.
	(get_template_base_recursive): Likewise.
	(coerce_template_template_parms): Provide prototype.
	(tsubst_function_type): Likewise.
	(try_class_unification): New function.
	All callers changed to use new complain parameter.
	(get_template_base): Use try_class_unification.
	(unify): Adjust handling of classes derived from template types.
	(fn_type_unification): Substitute explicit arguments before
	unification.

From-SVN: r25243
parent 0c20d3d6
1999-02-16 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (tsubst): Change prototype.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(type_unification): Remove prototype.
* call.c (convert_default_arg): Adjust call to tsubst_expr.
* class.c (resolve_address_of_overloaded_function): Just use
fn_type_unification.
* decl.c (grokdeclarator): Adjust call to tsubst.
* method.c (build_template_parm_names): Likewise.
* pt.c (GTB_VIA_VIRTUAL): New macro.
(GTB_IGNORE_TYPE): Likewise.
(resolve_overloaded_unification): Add `complain' parameter.
(try_one_overload): Likewise.
(tsubst_template_arg_vector): Likewise.
(tsubst_template_parms): Likewise.
(tsubst_aggr_type): Likewise.
(tsubst_arg_types): Likewise.
(tsubst_call_declarator_parms): Likewise.
(unify): Remove explicit_mask.
(type_unification_real): Likewise.
(get_template_base_recursive): Likewise.
(coerce_template_template_parms): Provide prototype.
(tsubst_function_type): Likewise.
(try_class_unification): New function.
All callers changed to use new complain parameter.
(get_template_base): Use try_class_unification.
(unify): Adjust handling of classes derived from template types.
(fn_type_unification): Substitute explicit arguments before
unification.
1999-02-16 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
* decl.c (pushdecl): Remove dead code.
......
......@@ -3205,7 +3205,7 @@ convert_default_arg (type, arg, fn)
if (DECL_CLASS_SCOPE_P (fn))
pushclass (DECL_REAL_CONTEXT (fn), 2);
arg = tsubst_expr (arg, DECL_TI_ARGS (fn), NULL_TREE);
arg = tsubst_expr (arg, DECL_TI_ARGS (fn), /*complain=*/1, NULL_TREE);
if (DECL_CLASS_SCOPE_P (fn))
popclass (1);
......
......@@ -5106,17 +5106,12 @@ resolve_address_of_overloaded_function (target_type,
tree fns;
if (is_ptrmem)
{
target_fn_type
= TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (target_type));
target_arg_types = TREE_CHAIN (TYPE_ARG_TYPES (target_fn_type));
}
target_fn_type
= TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (target_type));
else
{
target_fn_type = TREE_TYPE (target_type);
target_arg_types = TYPE_ARG_TYPES (target_fn_type);
}
target_fn_type = TREE_TYPE (target_type);
target_arg_types = TYPE_ARG_TYPES (target_fn_type);
for (fns = overload; fns; fns = OVL_CHAIN (fns))
{
tree fn = OVL_FUNCTION (fns);
......@@ -5131,26 +5126,15 @@ resolve_address_of_overloaded_function (target_type,
if ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
!= is_ptrmem)
/* We're looking for a non-static member, and this isn't
/* We're not looking for a non-static member, and this is
one, or vice versa. */
continue;
/* We don't use the `this' argument to do argument deduction
since that would prevent us from converting a base class
pointer-to-member to a derived class pointer-to-member. */
fn_arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
if (is_ptrmem)
fn_arg_types = TREE_CHAIN (fn_arg_types);
/* Try to do argument deduction. */
targs = make_scratch_vec (DECL_NTPARMS (fn));
if (type_unification (DECL_INNERMOST_TEMPLATE_PARMS (fn),
targs,
fn_arg_types,
target_arg_types,
explicit_targs,
DEDUCE_EXACT,
/*allow_incomplete=*/1) != 0)
if (fn_type_unification (fn, explicit_targs, targs,
target_arg_types, NULL_TREE,
DEDUCE_EXACT, NULL_TREE) != 0)
/* Argument deduction failed. */
continue;
......
......@@ -3041,9 +3041,9 @@ extern tree get_id_2 PROTO((char *, tree));
/* in pt.c */
extern void check_template_shadow PROTO ((tree));
extern tree innermost_args PROTO ((tree));
extern tree tsubst PROTO ((tree, tree, tree));
extern tree tsubst_expr PROTO ((tree, tree, tree));
extern tree tsubst_copy PROTO ((tree, tree, tree));
extern tree tsubst PROTO ((tree, tree, int, tree));
extern tree tsubst_expr PROTO ((tree, tree, int, tree));
extern tree tsubst_copy PROTO ((tree, tree, int, tree));
extern void maybe_begin_member_template_processing PROTO((tree));
extern void maybe_end_member_template_processing PROTO((void));
extern tree finish_member_template_decl PROTO((tree));
......@@ -3069,7 +3069,6 @@ extern tree instantiate_class_template PROTO((tree));
extern tree instantiate_template PROTO((tree, tree));
extern void overload_template_name PROTO((tree));
extern int fn_type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t, tree));
extern int type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t, int));
struct tinst_level *tinst_for_decl PROTO((void));
extern void mark_decl_instantiated PROTO((tree, int));
extern int more_specialized PROTO((tree, tree, tree));
......
......@@ -10397,7 +10397,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& uses_template_parms (current_class_type))
{
tree args = current_template_args ();
type = tsubst (type, args, NULL_TREE);
type = tsubst (type, args, /*complain=*/1, NULL_TREE);
}
/* This pop_nested_class corresponds to the
......
......@@ -938,7 +938,7 @@ build_template_parm_names (parmlist, arglist)
}
else
{
parm = tsubst (parm, arglist, NULL_TREE);
parm = tsubst (parm, arglist, /*complain=*/1, NULL_TREE);
/* It's a PARM_DECL. */
build_mangled_name_for_type (TREE_TYPE (parm));
build_overload_value (TREE_TYPE (parm), arg,
......
// Build don't link:
// GROUPS passed templates
template <class T, class U>
T foo(T t, U* u); // ERROR - template candidate
T foo(T t, U* u);
template <class T>
T foo(T t, T* t); // ERROR - template candidate
T foo(T t, T* u);
template <>
int foo<int>(int, int*); // ERROR - ambiguous template specialization
int foo<int>(int, int*);
// Build don't link:
template <int I, int J, int K>
struct S {};
template <int I, int J>
struct S<I, J, 2> : public S<I, I, I>, S<J, J, J> {};
template <int I, int J, int K>
void f(S<I, J, K>, S<I, I, I>);
void g() {
S<0, 0, 0> s0;
S<0, 1, 2> s2;
f<0>(s0, s2);
f(s0, s2); // ERROR - no matching function
}
// Build don't link:
template <int I>
struct A {
};
template <int I, int J>
struct B {
operator A<3> ();
operator B<3, 7> ();
};
template <int I, int J>
void f(B<I, J>);
template <int I>
void f(A<I>)
{
}
int main()
{
// Deduction fails with the first `f'. Since `3' is explicitly
// specified, we don't try any deduction with the second `f'. So,
// we call the second `f'.
f<3>(B<2, 7>());
}
// Build don't link:
template <int I>
void f(int (*)[I] = 0);
template <int J>
void f();
void g()
{
f<-1>();
}
// Build don't link:
template<int I> struct A { };
template<int I, int J> int f(A<I+J>);
int g() {
A<3> a;
return f<1,2>(a);
}
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