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
This commit is contained in:
Jason Merrill 2010-06-15 16:10:29 -04:00 committed by Jason Merrill
parent 5c77749e30
commit e14eaea4d4
7 changed files with 23 additions and 27 deletions

View File

@ -1,5 +1,9 @@
2010-06-15 Jason Merrill <jason@redhat.com>
* 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.

View File

@ -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,

View File

@ -1,5 +1,7 @@
2010-06-15 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/defaulted18.C: New.
* g++.dg/cpp0x/initlist40.C: New.
* g++.dg/cpp0x/initlist39.C: New.

View File

@ -0,0 +1,9 @@
// { dg-options "-std=c++0x" }
void f(char i, int j) = delete; // { dg-message "<deleted>" }
void f(int i, ...); // { dg-message "void f" }
int main()
{
f(1,1); // { dg-error "ambiguous" }
}

View File

@ -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" }

View File

@ -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" }

View File

@ -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" }