diff options
author | Jason Merrill <jason@redhat.com> | 2010-09-18 17:22:10 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-09-18 17:22:10 -0400 |
commit | 6eb208a69cd0b7d93c3f22f4298062ccdc2f7c83 (patch) | |
tree | ee2d660a38aa69b21010ac19f588c48841332b8d /gcc | |
parent | 6a78fd06c54495e0f8dc5c5941c9313fa5046f54 (diff) | |
download | gcc-6eb208a69cd0b7d93c3f22f4298062ccdc2f7c83.zip gcc-6eb208a69cd0b7d93c3f22f4298062ccdc2f7c83.tar.gz gcc-6eb208a69cd0b7d93c3f22f4298062ccdc2f7c83.tar.bz2 |
call.c (compare_ics): Do lvalue/rvalue reference binding comparison for ck_list, too.
* call.c (compare_ics): Do lvalue/rvalue reference binding
comparison for ck_list, too.
From-SVN: r164401
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist44.C | 5 |
4 files changed, 27 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c412f0c..cedf531 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-09-18 Jason Merrill <jason@redhat.com> + + * call.c (compare_ics): Do lvalue/rvalue reference binding + comparison for ck_list, too. + 2010-09-15 Jason Merrill <jason@redhat.com> * semantics.c (finish_id_expression): Diagnose use of function diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 2b9b848..89ab757 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6859,9 +6859,8 @@ compare_ics (conversion *ics1, conversion *ics2) /* We couldn't make up our minds; try to figure it out below. */ } - if (ics1->ellipsis_p || ics1->kind == ck_list) - /* Both conversions are ellipsis conversions or both are building a - std::initializer_list. */ + if (ics1->ellipsis_p) + /* Both conversions are ellipsis conversions. */ return 0; /* User-defined conversion sequence U1 is a better conversion sequence @@ -6870,16 +6869,24 @@ compare_ics (conversion *ics1, conversion *ics2) ond standard conversion sequence of U1 is better than the second standard conversion sequence of U2. */ - if (ics1->user_conv_p) + /* Handle list-conversion with the same code even though it isn't always + ranked as a user-defined conversion and it doesn't have a second + standard conversion sequence; it will still have the desired effect. + Specifically, we need to do the reference binding comparison at the + end of this function. */ + + if (ics1->user_conv_p || ics1->kind == ck_list) { conversion *t1; conversion *t2; for (t1 = ics1; t1->kind != ck_user; t1 = t1->u.next) - if (t1->kind == ck_ambig || t1->kind == ck_aggr) + if (t1->kind == ck_ambig || t1->kind == ck_aggr + || t1->kind == ck_list) break; for (t2 = ics2; t2->kind != ck_user; t2 = t2->u.next) - if (t2->kind == ck_ambig || t2->kind == ck_aggr) + if (t2->kind == ck_ambig || t2->kind == ck_aggr + || t2->kind == ck_list) break; if (t1->kind != t2->kind) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fb1fa0..56d0fbd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-09-18 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/initlist44.C: New. + 2010-09-18 Richard Guenther <rguenther@suse.de> PR tree-optimization/45709 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist44.C b/gcc/testsuite/g++.dg/cpp0x/initlist44.C new file mode 100644 index 0000000..fbe0ea3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist44.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +#include <initializer_list> + +auto value = std::initializer_list<int>{ 1, 2, 3 }; |