summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-31 14:28:41 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-31 14:28:41 +0000
commitf89d87ce88c2b27aafaa70a2d971ea085dd3876d (patch)
treee24770d7c4a02798809f880080b3317cee21018a
parent3be56872fc6d3693897c07ad6ec9e342df00c47b (diff)
downloadgcc-f89d87ce88c2b27aafaa70a2d971ea085dd3876d.tar.gz
PR c++/53500
PR c++/52905 * call.c (joust): Handle comparing list and non-list ctors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@188063 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-ctor1.C13
4 files changed, 30 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 584f794bcfc..10ada129f6a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/53500
+ PR c++/52905
+ * call.c (joust): Handle comparing list and non-list ctors.
+
2012-05-30 Jason Merrill <jason@redhat.com>
PR c++/53356
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 59e6e49caa7..2499ad1b6bd 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -8015,6 +8015,12 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
int static_1 = DECL_STATIC_FUNCTION_P (cand1->fn);
int static_2 = DECL_STATIC_FUNCTION_P (cand2->fn);
+ if (DECL_CONSTRUCTOR_P (cand1->fn)
+ && is_list_ctor (cand1->fn) != is_list_ctor (cand2->fn))
+ /* We're comparing a near-match list constructor and a near-match
+ non-list constructor. Just treat them as unordered. */
+ return 0;
+
gcc_assert (static_1 != static_2);
if (static_1)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9a3a04a36bf..f0d38750474 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/52905
+ * g++.dg/cpp0x/initlist-ctor1.C: New.
+
2012-05-31 Richard Guenther <rguenther@suse.de>
PR middle-end/48493
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-ctor1.C b/gcc/testsuite/g++.dg/cpp0x/initlist-ctor1.C
new file mode 100644
index 00000000000..82031cbcc84
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-ctor1.C
@@ -0,0 +1,13 @@
+// PR c++/52905
+// { dg-options -std=c++11 }
+
+#include <initializer_list>
+
+enum E { e1, e2 };
+struct A
+{
+ A(std::initializer_list<E>); // { dg-message "A::A" }
+ A(int, E); // { dg-message "A::A" }
+};
+
+A a{e1,2}; // { dg-error "" }