diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1258194fa941..594b2c670287 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2009-10-31 Jason Merrill + + PR c++/41754 + * call.c (compare_ics): Avoid bad union use when + comparing two ck_lists. + 2009-10-30 Jerry Quinn * mangle.c (mangle_type_string_for_rtti): Reapply 153734. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d4bdcbae66ef..463257cd5afc 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 14c8a50d711e..e26126ee0b12 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-10-31 Jason Merrill + + PR c++/41754 + * g++.dg/cpp0x/initlist25.C: New. + 2009-10-31 Eric Botcazou * 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 000000000000..8e5e0065cfc6 --- /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 +#include +#include + +using namespace std; + +int main() +{ + map m; + m.insert({{"t", "t"}, {"y", "y"}}); + + return 0; +}