diff options
author | Jason Merrill <jason@redhat.com> | 2010-09-15 19:55:35 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-09-15 19:55:35 -0400 |
commit | 02a39a93ce25e78a1698001e1fefd6d96f644231 (patch) | |
tree | ab157a8a677650ad8da116c8ad3d8f7401e06e59 /gcc/cp | |
parent | 9fa07b131e21a921ecc535f736882a5fb0698a9c (diff) | |
download | gcc-02a39a93ce25e78a1698001e1fefd6d96f644231.zip gcc-02a39a93ce25e78a1698001e1fefd6d96f644231.tar.gz gcc-02a39a93ce25e78a1698001e1fefd6d96f644231.tar.bz2 |
call.c (convert_like_real): Use the underlying type of the reference for the temporary.
* call.c (convert_like_real): Use the underlying type of the
reference for the temporary.
From-SVN: r164320
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index efa238a..27cb326 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-09-15 Jason Merrill <jason@redhat.com> + + * call.c (convert_like_real): Use the underlying type of the + reference for the temporary. + 2010-09-15 Jakub Jelinek <jakub@redhat.com> PR c++/45635 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 37c6269..2b9b848 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5207,10 +5207,16 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, || TREE_CODE (expr) == CONSTRUCTOR || TREE_CODE (expr) == VA_ARG_EXPR) { - tree type = convs->u.next->type; + /* Otherwise, a temporary of type "cv1 T1" is created and + initialized from the initializer expression using the rules + for a non-reference copy-initialization (8.5). */ + + tree type = TREE_TYPE (ref_type); cp_lvalue_kind lvalue = real_lvalue_p (expr); - if (!CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (ref_type)) + gcc_assert (same_type_ignoring_top_level_qualifiers_p + (type, convs->u.next->type)); + if (!CP_TYPE_CONST_NON_VOLATILE_P (type) && !TYPE_REF_IS_RVALUE (ref_type)) { if (complain & tf_error) |