aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-10-14 02:27:50 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-10-14 02:27:50 -0400
commitf067355594fbd09b80905377872c735df6406e70 (patch)
tree2fc25f36fb77676e714c35536e648cf290e69e3c
parent9524f7104acba2f1eea83467eb9e0bc974cfd4e3 (diff)
downloadgcc-f067355594fbd09b80905377872c735df6406e70.zip
gcc-f067355594fbd09b80905377872c735df6406e70.tar.gz
gcc-f067355594fbd09b80905377872c735df6406e70.tar.bz2
re PR c++/39866 ([c++0x] deleted functions not removed from "no match" error messages)
PR c++/39866 * call.c (print_z_candidates): Don't print deleted candidates. (print_z_candidate): Note deleted candidates. From-SVN: r152752
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c22
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted14.C18
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc11
6 files changed, 59 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 06659aa..d36aea5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/39866
+ * call.c (print_z_candidates): Don't print deleted candidates.
+ (print_z_candidate): Note deleted candidates.
+
2009-10-14 Larry Evans <cppljevans@suddenlink.net>
PR c++/40092
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 3fc22f2..ff22d9e 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2718,6 +2718,8 @@ print_z_candidate (const char *msgstr, struct z_candidate *candidate)
inform (input_location, "%s %T <conversion>", msgstr, candidate->fn);
else if (candidate->viable == -1)
inform (input_location, "%s %+#D <near match>", msgstr, candidate->fn);
+ else if (DECL_DELETED_FN (candidate->fn))
+ inform (input_location, "%s %+#D <deleted>", msgstr, candidate->fn);
else
inform (input_location, "%s %+#D", msgstr, candidate->fn);
}
@@ -2729,6 +2731,23 @@ print_z_candidates (struct z_candidate *candidates)
struct z_candidate *cand1;
struct z_candidate **cand2;
+ if (!candidates)
+ return;
+
+ /* Remove deleted candidates. */
+ cand1 = candidates;
+ for (cand2 = &cand1; *cand2; )
+ {
+ if (TREE_CODE ((*cand2)->fn) == FUNCTION_DECL
+ && DECL_DELETED_FN ((*cand2)->fn))
+ *cand2 = (*cand2)->next;
+ else
+ cand2 = &(*cand2)->next;
+ }
+ /* ...if there are any non-deleted ones. */
+ if (cand1)
+ candidates = cand1;
+
/* There may be duplicates in the set of candidates. We put off
checking this condition as long as possible, since we have no way
to eliminate duplicates from a set of functions in less than n^2
@@ -2751,9 +2770,6 @@ print_z_candidates (struct z_candidate *candidates)
}
}
- if (!candidates)
- return;
-
str = _("candidates are:");
print_z_candidate (str, candidates);
if (candidates->next)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e2a9cfe..1cf82ff 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/39866
+ * g++.dg/cpp0x/defaulted14.C: New.
+
2009-10-14 Larry Evans <cppljevans@suddenlink.net>
* g++.dg/cpp0x/vt-40092.C: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted14.C b/gcc/testsuite/g++.dg/cpp0x/defaulted14.C
new file mode 100644
index 0000000..235e646
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted14.C
@@ -0,0 +1,18 @@
+// PR c++/39866
+// { dg-options "-std=c++0x" }
+
+struct A {
+ A& operator=(const A&) = delete; // { dg-bogus "" }
+
+ void operator=(int) {} // { dg-message "" }
+ void operator=(char) {} // { dg-message "" }
+};
+
+struct B {};
+
+int main()
+{
+ A a;
+ a = B(); // { dg-error "no match" }
+ a = 1.0; // { dg-error "ambiguous" }
+}
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 424967d..35c1f3a 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,7 @@
+2009-10-14 Jason Merrill <jason@redhat.com>
+
+ * testsuite/20_util/unique_ptr/assign/assign_neg.cc: Adjust expecteds.
+
2009-10-13 Paolo Carlini <paolo.carlini@oracle.com>
* include/parallel/for_each_selectors.h: Minor uglification and
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
index f0236eb..bf49aa6 100644
--- a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
@@ -49,10 +49,13 @@ test03()
std::unique_ptr<int[2]> p2 = p1;
}
+// { dg-error "deleted function" "" { target *-*-* } 358 }
// { dg-error "used here" "" { target *-*-* } 42 }
// { dg-error "no matching" "" { target *-*-* } 48 }
-// { dg-error "used here" "" { target *-*-* } 49 }
-// { dg-error "candidates are" "" { target *-*-* } 213 }
+// { dg-warning "candidates are" "" { target *-*-* } 119 }
+// { dg-warning "note" "" { target *-*-* } 112 }
+// { dg-warning "note" "" { target *-*-* } 107 }
+// { dg-warning "note" "" { target *-*-* } 102 }
+// { dg-warning "note" "" { target *-*-* } 96 }
// { dg-error "deleted function" "" { target *-*-* } 213 }
-// { dg-error "deleted function" "" { target *-*-* } 358 }
-// { dg-excess-errors "note" }
+// { dg-error "used here" "" { target *-*-* } 49 }