re PR c++/45329 (When printing a list of candidate functions, explain why each functi...
authorNathan Froyd <froydnj@codesourcery.com>
Sun, 17 Jul 2011 02:34:10 +0000 (02:34 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 17 Jul 2011 02:34:10 +0000 (22:34 -0400)
commit3d2f6864225cc660adfc9136c859dd26e2a40135
tree8686f4122e795ce6ee0e3abdbf5a370034464f27
parentc6f4a801a697e19df5560fb79b91fe7ee77a1cca
re PR c++/45329 (When printing a list of candidate functions, explain why each function failed to match.)

PR c++/45329
PR c++/48934
* cp-tree.h (fn_type_unification): Add `bool' parameter.
* pt.c (enum template_base_result): Define.
(unify_success, unify_unknown): Define.
(unify_parameter_deduction_failure): Define.
(unify_invalid, unify_cv_qual_mismatch, unify_type_mismatch): Define.
(unify_parameter_pack_mismatch): Define.
(unify_parameter_pack_inconsistent): Define.
(unify_ptrmem_cst_mismatch, unify_vla_arg): Define.
(unify_expression_unequal, unify_inconsistency): Define.
(unify_method_type_error, unify_arity): Likewise.
(unify_too_many_parameters, unify_too_few_parameters): Define.
(unify_arg_conversion, unify_no_common_base): Define.
(unify_illformed_ptrmem_cst_expr): Define.
(unify_substitution_failure): Define.
(unify_inconsistent_template_template_parameters): Define.
(unify_template_deduction_failure): Define.
(unify_template_argument_mismatch): Define.
(unify_overload_resolution_failure): Define.
(comp_template_args_with_info): New function, split out from...
(comp_template_args): ...here. Call it.
(deduction_tsubst_fntype): Add `complain' parameter'.  Pass it
to tsubst.
(unify): Add `explain_p' parameter.  Pass to all relevant calls.
Call above status functions when appropriate.
(resolve_overloaded_unification, try_one_overload): Likewise.
(type_unification, type_unification_real): Likewise.
(unify_pack_expansion): Likewise.
(get_template_base, try_class_unification): Likewise.
(get_bindings, more_specialized_fn): Pass false to unification
calls.
(get_class_bindings, do_auto_deduction): Likewise.
(convert_nontype_argument): Likewise.
(fn_type_unification): Likewise.  Pass tf_warning_or_error if
explain_p.
(get_template_base): Add `explain_p' parameter and pass it to
try_class_unification. Return an enum template_base_result.
* class.c (resolve_address_of_overloaded_function): Pass false to
fn_type_unification.
* call.c (enum rejection_reason_code): Add new codes.
(struct rejection_reason): Add template_unification field.
Add template_instantiation field.
(template_unification_rejection): Define.
(template_unification_error_rejection): Define.
(template_instantiation_rejection): Define.
(invalid_copy_with_fn_template_rejection): Define.
(add_template_candidate): Pass false to unify.
Provide more rejection reasons when possible.
(print_template_unification_rejection): Define.
(print_arity_rejection): Define, split out from...
(print_z_candidate): ...here.  Add cases for new rejection
reasons.

Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r176365
58 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype29.C
gcc/testsuite/g++.dg/cpp0x/error4.C
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C
gcc/testsuite/g++.dg/cpp0x/nullptr15.C
gcc/testsuite/g++.dg/cpp0x/pr31431-2.C
gcc/testsuite/g++.dg/cpp0x/pr31431.C
gcc/testsuite/g++.dg/cpp0x/pr31434.C
gcc/testsuite/g++.dg/cpp0x/sfinae11.C
gcc/testsuite/g++.dg/cpp0x/sfinae26.C
gcc/testsuite/g++.dg/cpp0x/temp_default2.C
gcc/testsuite/g++.dg/cpp0x/trailing4.C
gcc/testsuite/g++.dg/cpp0x/variadic-ex3.C
gcc/testsuite/g++.dg/cpp0x/variadic-ex4.C
gcc/testsuite/g++.dg/cpp0x/variadic105.C
gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C
gcc/testsuite/g++.dg/ext/vla2.C
gcc/testsuite/g++.dg/other/ptrmem10.C
gcc/testsuite/g++.dg/other/ptrmem11.C
gcc/testsuite/g++.dg/overload/template5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/overload/unknown1.C
gcc/testsuite/g++.dg/template/conv11.C
gcc/testsuite/g++.dg/template/deduce3.C
gcc/testsuite/g++.dg/template/dependent-expr5.C
gcc/testsuite/g++.dg/template/error45.C
gcc/testsuite/g++.dg/template/friend.C
gcc/testsuite/g++.dg/template/incomplete2.C
gcc/testsuite/g++.dg/template/local4.C
gcc/testsuite/g++.dg/template/local6.C
gcc/testsuite/g++.dg/template/operator9.C
gcc/testsuite/g++.dg/template/overload12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/ptrmem2.C
gcc/testsuite/g++.dg/template/sfinae2.C
gcc/testsuite/g++.dg/template/ttp25.C
gcc/testsuite/g++.dg/template/unify10.C
gcc/testsuite/g++.dg/template/unify11.C
gcc/testsuite/g++.dg/template/unify6.C
gcc/testsuite/g++.dg/template/unify7.C
gcc/testsuite/g++.dg/template/unify9.C
gcc/testsuite/g++.dg/template/varmod1.C
gcc/testsuite/g++.old-deja/g++.brendan/crash56.C
gcc/testsuite/g++.old-deja/g++.pt/crash28.C
gcc/testsuite/g++.old-deja/g++.pt/crash60.C
gcc/testsuite/g++.old-deja/g++.pt/explicit41.C
gcc/testsuite/g++.old-deja/g++.pt/explicit77.C
gcc/testsuite/g++.old-deja/g++.pt/expr2.C
gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C
gcc/testsuite/g++.old-deja/g++.pt/spec5.C
gcc/testsuite/g++.old-deja/g++.pt/spec6.C
gcc/testsuite/g++.old-deja/g++.pt/unify4.C
gcc/testsuite/g++.old-deja/g++.pt/unify6.C
gcc/testsuite/g++.old-deja/g++.pt/unify8.C
gcc/testsuite/g++.old-deja/g++.robertl/eb98.C