aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-04-13 15:43:47 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-04-13 15:43:47 -0400
commit7aca561c8671a2ef8203c5571714b7886e2c8758 (patch)
treeae4a6dacf90ea73bedc267dbc4518e3721f99c29 /gcc
parent7996b7273cfb3b494e5c31e8c68e0f7fd9c87aa1 (diff)
downloadgcc-7aca561c8671a2ef8203c5571714b7886e2c8758.zip
gcc-7aca561c8671a2ef8203c5571714b7886e2c8758.tar.gz
gcc-7aca561c8671a2ef8203c5571714b7886e2c8758.tar.bz2
re PR c++/52905 ([C++0x] ice on invalid brace-enclosed initializer of vector of enums)
PR c++/52905 * call.c (joust): Handle comparing list and non-list ctors. From-SVN: r186433
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/call.c6
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-ctor1.C13
4 files changed, 25 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4bb7937..e8bcc37 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2012-04-13 Jason Merrill <jason@redhat.com>
+ PR c++/52905
+ * call.c (joust): Handle comparing list and non-list ctors.
+
PR c++/52915
* decl2.c (finish_anon_union): Use cp_finish_decl.
* error.c (dump_function_name): Avoid showing anonymous "name".
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 3c3dabb7..46ac55c 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -8011,6 +8011,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 587e112..e3ea64a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2012-04-13 Jason Merrill <jason@redhat.com>
+ PR c++/52905
+ * g++.dg/cpp0x/initlist-ctor1.C: New.
+
PR c++/52915
* g++.dg/other/anon-union2.C: New.
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 0000000..82031cb
--- /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 "" }