diff options
author | Jason Merrill <jason@redhat.com> | 2010-06-15 15:58:35 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-06-15 15:58:35 -0400 |
commit | 756bcf03e203d553ea99f834879407bf0585c90a (patch) | |
tree | bf98c80f24289e64526c4b763ea456d12819f22d | |
parent | 6ab4e30772ed8513b2ae951524a554d2f05fcc15 (diff) | |
download | gcc-756bcf03e203d553ea99f834879407bf0585c90a.zip gcc-756bcf03e203d553ea99f834879407bf0585c90a.tar.gz gcc-756bcf03e203d553ea99f834879407bf0585c90a.tar.bz2 |
call.c (is_subseq): Handle ck_aggr, ck_list.
* call.c (is_subseq): Handle ck_aggr, ck_list.
(compare_ics): Treat an aggregate or ambiguous conversion to the
same type as involving the same function.
From-SVN: r160804
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 20 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist39.C | 15 |
4 files changed, 42 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 092cf7f..7fc5210 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-06-15 Jason Merrill <jason@redhat.com> + + * call.c (is_subseq): Handle ck_aggr, ck_list. + (compare_ics): Treat an aggregate or ambiguous conversion to the + same type as involving the same function. + 2010-06-13 Shujing Zhao <pearly.zhao@oracle.com> * typeck.c (convert_for_assignment): Fix comment. Change message diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f46fbf7..9ce1c53 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6578,6 +6578,8 @@ is_subseq (conversion *ics1, conversion *ics2) if (ics2->kind == ck_user || ics2->kind == ck_ambig + || ics2->kind == ck_aggr + || ics2->kind == ck_list || ics2->kind == ck_identity) /* At this point, ICS1 cannot be a proper subsequence of ICS2. We can get a USER_CONV when we are comparing the @@ -6762,13 +6764,25 @@ compare_ics (conversion *ics1, conversion *ics2) for (t1 = ics1; t1->kind != ck_user; t1 = t1->u.next) if (t1->kind == ck_ambig || t1->kind == ck_aggr) - return 0; + break; for (t2 = ics2; t2->kind != ck_user; t2 = t2->u.next) if (t2->kind == ck_ambig || t2->kind == ck_aggr) - return 0; + break; - if (t1->cand->fn != t2->cand->fn) + if (t1->kind != t2->kind) return 0; + else if (t1->kind == ck_user) + { + if (t1->cand->fn != t2->cand->fn) + return 0; + } + else + { + /* For ambiguous or aggregate conversions, use the target type as + a proxy for the conversion function. */ + if (!same_type_ignoring_top_level_qualifiers_p (t1->type, t2->type)) + return 0; + } /* We can just fall through here, after setting up FROM_TYPE1 and FROM_TYPE2. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 60d29a1..910dcc1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-06-15 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/initlist39.C: New. + 2010-06-15 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/44391 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist39.C b/gcc/testsuite/g++.dg/cpp0x/initlist39.C new file mode 100644 index 0000000..a6dd1ec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist39.C @@ -0,0 +1,15 @@ +// { dg-options -std=c++0x } + +struct A { int i; }; + +void f (const A &); +void f (A &&); + +void g (A, int); +void g (A, double); + +int main() +{ + f ( { 1 } ); + g ( { 1 }, 1 ); +} |