commit 395c33cab4ccb366f7cc51c4bc275fbc8ecc80fb
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jun 15 12:18:58 2010 -0400
* 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.
@@ -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,
new file mode 100644
@@ -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" }
+}
@@ -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" }
@@ -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" }
@@ -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" }