diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2011-07-17 02:34:10 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-07-16 22:34:10 -0400 |
commit | 3d2f6864225cc660adfc9136c859dd26e2a40135 (patch) | |
tree | 8686f4122e795ce6ee0e3abdbf5a370034464f27 /gcc/testsuite/g++.old-deja | |
parent | c6f4a801a697e19df5560fb79b91fe7ee77a1cca (diff) | |
download | gcc-3d2f6864225cc660adfc9136c859dd26e2a40135.zip gcc-3d2f6864225cc660adfc9136c859dd26e2a40135.tar.gz gcc-3d2f6864225cc660adfc9136c859dd26e2a40135.tar.bz2 |
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
Diffstat (limited to 'gcc/testsuite/g++.old-deja')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.brendan/crash56.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/crash28.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/crash60.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/explicit41.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/explicit77.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/expr2.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/spec5.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/spec6.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/unify4.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/unify6.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/unify8.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.robertl/eb98.C | 2 |
13 files changed, 17 insertions, 17 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C index a22615d..e3bff80 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C @@ -278,7 +278,7 @@ SetLD<T>::remove(const T& item) Vix x; for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a)) a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // { dg-error "" } .* - // { dg-message "candidate" "candidate note" { target *-*-* } 280 } + // { dg-message "(candidate|not derived from)" "candidate note" { target *-*-* } 280 } } template<class T> bool @@ -287,7 +287,7 @@ SetLD<T>::contains(const T& item) const Vix x; for (first(x); 0 != x; next(x)) { if (operator()(x) == item)// { dg-error "" } .* - // { dg-message "candidate" "candidate note" { target *-*-* } 289 } + // { dg-message "(candidate|not derived from)" "candidate note" { target *-*-* } 289 } return TRUE; } return FALSE; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash28.C b/gcc/testsuite/g++.old-deja/g++.pt/crash28.C index 2cfed93..81ed85a 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash28.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash28.C @@ -11,5 +11,5 @@ void f(unsigned int n) { int x[n]; asize(x); // { dg-error "" } no matching function - // { dg-message "candidate" "candidate note" { target *-*-* } 13 } + // { dg-message "(candidate|not a valid template argument)" "candidate note" { target *-*-* } 13 } } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash60.C b/gcc/testsuite/g++.old-deja/g++.pt/crash60.C index 1aad621..747af9b 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash60.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash60.C @@ -7,7 +7,7 @@ template< typename SID, class SDR > void k( SID sid, SDR* p, void (SDR::*) - ( typename SID::T ) ); // { dg-message "note" } + ( typename SID::T ) ); // { dg-error "no type named 'T'" } struct E { }; struct S { void f( int ); }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit41.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit41.C index 560370a..c27d131 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit41.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit41.C @@ -1,6 +1,6 @@ // { dg-do assemble } template <int I> -void f(int i); // { dg-message "note" } +void f(int i); // { dg-message "void f" } void g() { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit77.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit77.C index 1213a15..b97c1cd 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit77.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit77.C @@ -15,5 +15,5 @@ void g() { f<0>(s0, s2); f(s0, s2); // { dg-error "" } no matching function - // { dg-message "candidate" "candidate note" { target *-*-* } 17 } + // { dg-message "(candidate|deduced conflicting types|ambiguous base class)" "candidate note" { target *-*-* } 17 } } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/expr2.C b/gcc/testsuite/g++.old-deja/g++.pt/expr2.C index 0dcc65f..06d22d5 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/expr2.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/expr2.C @@ -9,5 +9,5 @@ void foo(S<J + 2>); // { dg-message "note" } void bar() { foo(S<3>()); // { dg-error "" } no way to deduce J from this. - // { dg-message "candidate" "candidate note" { target *-*-* } 11 } + // { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 11 } } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C index 85d3e73..8802e98 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C @@ -13,9 +13,9 @@ public: }; template <void (A::*)() > -void g() {} // { dg-message "note" } +void g() {} // { dg-message "void g" } template <int A::*> -void h() {} // { dg-message "note" } +void h() {} // { dg-message "void h" } int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec5.C b/gcc/testsuite/g++.old-deja/g++.pt/spec5.C index df7112a..96e8cf9 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/spec5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec5.C @@ -14,9 +14,9 @@ template void g(int i, int j); void h() { f(3, 'c'); // { dg-error "" } no matching function - // { dg-message "candidate" "candidate note" { target *-*-* } 16 } + // { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 16 } g(3, 'c'); // { dg-error "" } no matching function - // { dg-message "candidate" "candidate note" { target *-*-* } 18 } + // { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 18 } } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec6.C b/gcc/testsuite/g++.old-deja/g++.pt/spec6.C index fc19c3c..b8f6673 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/spec6.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec6.C @@ -25,9 +25,9 @@ void h() { S1 s1; s1.f(3, 'c'); // { dg-error "" } no matching function - // { dg-message "candidate" "candidate note" { target *-*-* } 27 } + // { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 27 } S2<char> s2; s2.f(3, 'c'); // { dg-error "" } no matching function - // { dg-message "candidate" "candidate note" { target *-*-* } 31 } + // { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 31 } } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify4.C b/gcc/testsuite/g++.old-deja/g++.pt/unify4.C index 6dd9961..9285b21 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/unify4.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/unify4.C @@ -8,6 +8,6 @@ int main () { f (g); // { dg-error "" } ambiguous unification - // { dg-message "candidate" "candidate note" { target *-*-* } 10 } + // { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 10 } return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify6.C b/gcc/testsuite/g++.old-deja/g++.pt/unify6.C index 0e5c034..a6f7674 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/unify6.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/unify6.C @@ -19,7 +19,7 @@ template<> void fn<int &>() {} // ok, specialize A template<> void fn<void ()>() {} // ok, specialize A // now make sure we moan when we really should -template<class T> void foo(T const *){} // { dg-message "note" } +template<class T> void foo(T const *){} // { dg-error "pointer to reference" } void f() { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify8.C b/gcc/testsuite/g++.old-deja/g++.pt/unify8.C index 3209260..3a86d97 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/unify8.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/unify8.C @@ -16,6 +16,6 @@ void Foo (float); // { dg-message "note" } candidate void baz (int **p1) { Foo (p1); // { dg-error "match" } no such function - // { dg-message "candidate" "candidate note" { target *-*-* } 18 } + // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 18 } Bar (p1); // OK } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb98.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb98.C index c562031..410a336 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb98.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb98.C @@ -15,5 +15,5 @@ void f() { extent(b); // { dg-error "" } no matching function - // { dg-message "candidate" "candidate note" { target *-*-* } 17 } + // { dg-message "(candidate|mismatched types)" "candidate note" { target *-*-* } 17 } } |