aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-11-01 01:06:42 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-11-01 01:06:42 -0400
commit691a1b27dc12ad8994c852cc26c53ca7e9a6ed39 (patch)
tree11b4c93ada4acad59776683657641eb0d287ec4c
parentcc1e2504141ecc80bd2f7a18641f51cd2a040247 (diff)
downloadgcc-691a1b27dc12ad8994c852cc26c53ca7e9a6ed39.zip
gcc-691a1b27dc12ad8994c852cc26c53ca7e9a6ed39.tar.gz
gcc-691a1b27dc12ad8994c852cc26c53ca7e9a6ed39.tar.bz2
re PR c++/41754 (initializer list internal compiler segfault)
PR c++/41754 * call.c (compare_ics): Avoid bad union use when comparing two ck_lists. From-SVN: r153788
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist25.C17
4 files changed, 31 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1258194..594b2c6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/41754
+ * call.c (compare_ics): Avoid bad union use when
+ comparing two ck_lists.
+
2009-10-30 Jerry Quinn <jlquinn@optonline.net>
* mangle.c (mangle_type_string_for_rtti): Reapply 153734.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index d4bdcba..463257c 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -6617,8 +6617,9 @@ compare_ics (conversion *ics1, conversion *ics2)
/* We couldn't make up our minds; try to figure it out below. */
}
- if (ics1->ellipsis_p)
- /* Both conversions are ellipsis conversions. */
+ if (ics1->ellipsis_p || ics1->kind == ck_list)
+ /* Both conversions are ellipsis conversions or both are building a
+ std::initializer_list. */
return 0;
/* User-defined conversion sequence U1 is a better conversion sequence
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 14c8a50..e26126e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/41754
+ * g++.dg/cpp0x/initlist25.C: New.
+
2009-10-31 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/rep_clause4.ads: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist25.C b/gcc/testsuite/g++.dg/cpp0x/initlist25.C
new file mode 100644
index 0000000..8e5e006
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist25.C
@@ -0,0 +1,17 @@
+// PR c++/41754
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+#include <map>
+#include <string>
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ map<string, string> m;
+ m.insert({{"t", "t"}, {"y", "y"}});
+
+ return 0;
+}