From e14eaea4d4c3ce010cb58b428681e7d6723021a2 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 15 Jun 2010 16:10:29 -0400 Subject: call.c (print_z_candidates): Do print viable deleted candidates. * call.c (print_z_candidates): Do print viable deleted candidates. (joust): Don't choose a deleted function just because its worst conversion is better than another candidate's worst. From-SVN: r160808 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/call.c | 6 +++++- gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/cpp0x/defaulted18.C | 9 +++++++++ .../testsuite/29_atomics/atomic/cons/assign_neg.cc | 17 +---------------- .../29_atomics/atomic_address/cons/assign_neg.cc | 3 +-- .../29_atomics/atomic_integral/cons/assign_neg.cc | 9 +-------- 7 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted18.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c82db7e..d98eaae 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2010-06-15 Jason Merrill + * call.c (print_z_candidates): Do print viable deleted candidates. + (joust): Don't choose a deleted function just because its worst + conversion is better than another candidate's worst. + * call.c (convert_like_real): Don't complain about list-value-initialization from an explicit constructor. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 60d7333..a735dc6 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2747,11 +2747,12 @@ print_z_candidates (struct z_candidate *candidates) if (!candidates) return; - /* Remove deleted candidates. */ + /* Remove non-viable deleted candidates. */ cand1 = candidates; for (cand2 = &cand1; *cand2; ) { if (TREE_CODE ((*cand2)->fn) == FUNCTION_DECL + && !(*cand2)->viable && DECL_DELETED_FN ((*cand2)->fn)) *cand2 = (*cand2)->next; else @@ -7407,6 +7408,9 @@ tweak: winner = -1, w = cand2, l = cand1; if (winner) { + /* Don't choose a deleted function over ambiguity. */ + if (DECL_P (w->fn) && DECL_DELETED_FN (w->fn)) + return 0; if (warn) { pedwarn (input_location, 0, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e6ce32a..8ca6527 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2010-06-15 Jason Merrill + * g++.dg/cpp0x/defaulted18.C: New. + * g++.dg/cpp0x/initlist40.C: New. * g++.dg/cpp0x/initlist39.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted18.C b/gcc/testsuite/g++.dg/cpp0x/defaulted18.C new file mode 100644 index 0000000..ae055e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted18.C @@ -0,0 +1,9 @@ +// { dg-options "-std=c++0x" } + +void f(char i, int j) = delete; // { dg-message "" } +void f(int i, ...); // { dg-message "void f" } + +int main() +{ + f(1,1); // { dg-error "ambiguous" } +} diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc index b7cb05d..c56678c 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc @@ -28,20 +28,5 @@ int main() return 0; } -// { dg-error "used here" "" { target *-*-* } 522 } -// { dg-error "deleted function" "" { target *-*-* } 230 } -// { dg-error "deleted function" "" { target *-*-* } 248 } -// { dg-error "deleted function" "" { target *-*-* } 266 } -// { dg-error "deleted function" "" { target *-*-* } 284 } -// { dg-error "deleted function" "" { target *-*-* } 302 } -// { dg-error "deleted function" "" { target *-*-* } 320 } -// { dg-error "deleted function" "" { target *-*-* } 338 } -// { dg-error "deleted function" "" { target *-*-* } 356 } -// { dg-error "deleted function" "" { target *-*-* } 374 } -// { dg-error "deleted function" "" { target *-*-* } 392 } -// { dg-error "deleted function" "" { target *-*-* } 410 } -// { dg-error "deleted function" "" { target *-*-* } 428 } -// { dg-error "deleted function" "" { target *-*-* } 446 } -// { dg-error "deleted function" "" { target *-*-* } 464 } -// { dg-error "deleted function" "" { target *-*-* } 482 } +// { dg-error "ambiguous" "" { target *-*-* } 522 } // { dg-excess-errors "In member function" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc index 0ec1321..ac4c567 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc @@ -26,7 +26,6 @@ void test01() typedef std::atomic_address test_type; test_type t1; test_type t2; - t1 = t2; + t1 = t2; // { dg-error "ambiguous" } } -// { dg-error "used here" "" { target *-*-* } 29 } // { dg-excess-errors "deleted function" } diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc index b5fc5c3..875906f 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc @@ -29,12 +29,5 @@ int main() return 0; } -// { dg-error "used here" "" { target *-*-* } 522 } -// { dg-excess-errors "deleted function" } -// { dg-excess-errors "deleted function" } -// { dg-error "instantiated from" "" { target *-*-* } 28 } -// { dg-error "instantiated from" "" { target *-*-* } 529 } -// { dg-error "instantiated from" "" { target *-*-* } 170 } -// { dg-error "instantiated from" "" { target *-*-* } 399 } -// { dg-error "instantiated from" "" { target *-*-* } 168 } +// { dg-error "ambiguous" "" { target *-*-* } 522 } // { dg-excess-errors "In member function" } -- cgit v1.1