Commit 62e4a758 by Nathan Sidwell Committed by Nathan Sidwell

cp-tree.h (unification_kind_t): Add DEDUCE_ORDER.

cp:
	* cp-tree.h (unification_kind_t): Add DEDUCE_ORDER.
	(more_specialized): Add deduction parameter.
	* call.c (joust): Adjust more_specialized call.
	* pt.c (UNIFY_ALLOW_OUTER_MORE_CV_QUAL,
	UNIFY_ALLOW_OUTER_LESS_CV_QUAL): New unify flags.
	(get_bindings_order): Remove.
	(get_bindings_real): Add DEDUCE parameter.
	(maybe_adjust_types_for_deduction): Return extra unify flags. Do
	REFERENCE_TYPE jig for DEDUCE_ORDER.
	(type_unification_real): Deal with DEDUCE_ORDER. Use result of
	maybe_adjust_types_for_deduction.
	(more_specialized): Add DEDUCE parameter. Call get_bindings_real
	directly.
	(try_one_overload): Use result of maybe_adjust_types_for_deduction.
	(check_cv_quals_for_unify): Use new unify qualifier flags.
	(unify): Clear new unify qualifier flags.
	(get_bindings_real): Add DEDUCE parameter.
	(get_bindings): Adjust call to get_bindings_real.
	(get_bindings_overload): Likewise.
	(most_specialized_instantiation): Adjust call to
	more_specialized.
testsuite:
	* g++.old-deja/g++.martin/sts_partial.C: Remove XFAIL.
	* g++.old-deja/g++.pt/spec35.C: New test.
	* g++.old-deja/g++.pt/spec36.C: New test.

From-SVN: r39182
parent 0bbcfbaf
2001-01-22 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (unification_kind_t): Add DEDUCE_ORDER.
(more_specialized): Add deduction parameter.
* call.c (joust): Adjust more_specialized call.
* pt.c (UNIFY_ALLOW_OUTER_MORE_CV_QUAL,
UNIFY_ALLOW_OUTER_LESS_CV_QUAL): New unify flags.
(get_bindings_order): Remove.
(get_bindings_real): Add DEDUCE parameter.
(maybe_adjust_types_for_deduction): Return extra unify flags. Do
REFERENCE_TYPE jig for DEDUCE_ORDER.
(type_unification_real): Deal with DEDUCE_ORDER. Use result of
maybe_adjust_types_for_deduction.
(more_specialized): Add DEDUCE parameter. Call get_bindings_real
directly.
(try_one_overload): Use result of maybe_adjust_types_for_deduction.
(check_cv_quals_for_unify): Use new unify qualifier flags.
(unify): Clear new unify qualifier flags.
(get_bindings_real): Add DEDUCE parameter.
(get_bindings): Adjust call to get_bindings_real.
(get_bindings_overload): Likewise.
(most_specialized_instantiation): Adjust call to
more_specialized.
2001-01-19 Jason Merrill <jason@redhat.com>
* decl2.c (flag_vtable_thunks): Also depend on ENABLE_NEW_GXX_ABI.
......
......@@ -5196,6 +5196,7 @@ joust (cand1, cand2, warn)
else if (cand1->template && cand2->template)
winner = more_specialized
(TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template),
DEDUCE_ORDER,
/* Never do unification on the 'this' parameter. */
TREE_VEC_LENGTH (cand1->convs)
- DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn));
......
......@@ -3209,14 +3209,15 @@ extern int function_depth;
/* in pt.c */
/* These values are used for the `STRICT' parameter to type_unfication and
/* These values are used for the `STRICT' parameter to type_unification and
fn_type_unification. Their meanings are described with the
documentation for fn_type_unification. */
typedef enum unification_kind_t {
DEDUCE_CALL,
DEDUCE_CONV,
DEDUCE_EXACT
DEDUCE_EXACT,
DEDUCE_ORDER
} unification_kind_t;
/* Macros for operating on a template instantation level node, represented
......@@ -4143,7 +4144,7 @@ extern tree instantiate_template PARAMS ((tree, tree));
extern int fn_type_unification PARAMS ((tree, tree, tree, tree, tree, unification_kind_t, int));
extern tree tinst_for_decl PARAMS ((void));
extern void mark_decl_instantiated PARAMS ((tree, int));
extern int more_specialized PARAMS ((tree, tree, int));
extern int more_specialized PARAMS ((tree, tree, int, int));
extern void mark_class_instantiated PARAMS ((tree, int));
extern void do_decl_instantiation PARAMS ((tree, tree, tree));
extern void do_type_instantiation PARAMS ((tree, tree, int));
......
2001-01-22 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.martin/sts_partial.C: Remove XFAIL.
* g++.old-deja/g++.pt/spec35.C: New test.
* g++.old-deja/g++.pt/spec36.C: New test.
2001-01-20 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20010118-1.c: New test.
......
// excess errors test - XFAIL
// ecgs-bugs 1999-02-22 14:26 Stefan Schwarzer
// sts@ica1.uni-stuttgart.de
// partial ordering problem in egcs <= 1.1.1
......
// Build don't link:
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Jan 2001 <nathan@codesourcery.com>
// Bug 1617. We didn't resolve partial ordering properly. The std is rather
// vague about it anyway, DR 214 talks about this.
extern "C" int puts (char const *);
template <typename T> int Foo (T); // ERROR - candidate
template <typename T> int Foo (T &); // ERROR - candidate
template <typename T> int Qux (T); // ERROR - candidate
template <typename T> int Qux (T const &); // ERROR - candidate
template <typename T> int Bar (T const *const &); // ERROR - candidate
template <typename T> int Bar (T *const &); // ERROR - candidate
template <typename T> int Bar (T *); // ERROR - candidate
template <typename T> int Baz (T *const &); // ERROR - candidate
template <typename T> int Baz (T *); // ERROR - candidate
int Baz (int const *ptr, int *ptr2)
{
Baz (ptr2); // ERROR - ambiguous
Bar (ptr2); // ERROR - ambiguous
Foo (ptr2); // ERROR - ambiguous
Qux (ptr2); // ERROR - ambiguous
return 0;
}
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Jan 2001 <nathan@codesourcery.com>
// Bug 1617. We didn't resolve partial ordering properly. The std is rather
// vague about it anyway, DR 214 talks about this.
extern "C" int puts (char const *);
template <typename T> int Foo (T *) {puts (__PRETTY_FUNCTION__); return 1;}
template <typename T> int Foo (T &) {puts (__PRETTY_FUNCTION__); return 2;}
template <typename T> int Foo (T const &) {puts (__PRETTY_FUNCTION__); return 3;}
template <typename T> int Bar (T const *const &) {puts (__PRETTY_FUNCTION__); return 4;}
template <typename T> int Bar (T *const &) {puts (__PRETTY_FUNCTION__); return 5;}
template <typename T> int Bar (T *) {puts (__PRETTY_FUNCTION__); return 6;}
template <typename T> int Quux (T *const &) {puts (__PRETTY_FUNCTION__); return 7;}
template <typename T> int Quux (T const &) {puts (__PRETTY_FUNCTION__); return 8;}
int Baz (int const *ptr, int *ptr2)
{
if (Foo (ptr) != 1)
return 1;
if (Foo (ptr2) != 1)
return 2;
if (Foo (*ptr) != 3)
return 3;
if (Foo (*ptr2) != 2)
return 4;
if (Bar (ptr) != 4)
return 5;
if (Quux (ptr) != 7)
return 5;
if (Quux (ptr2) != 7)
return 6;
return 0;
}
int main ()
{
return Baz (0, 0);
}
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