]> gcc.gnu.org Git - gcc.git/commitdiff
call.c (convert_like_real): Use the underlying type of the reference for the temporary.
authorJason Merrill <jason@redhat.com>
Wed, 15 Sep 2010 23:55:35 +0000 (19:55 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 15 Sep 2010 23:55:35 +0000 (19:55 -0400)
* call.c (convert_like_real): Use the underlying type of the
reference for the temporary.

From-SVN: r164320

gcc/cp/ChangeLog
gcc/cp/call.c

index efa238a17fd1321738ba13bc97574b618c841d22..27cb326a7635eea7c09201f13f1c0eeb77f7d2e3 100644 (file)
@@ -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
index 37c6269455eb33f76a9a89687ed35e184f32e273..2b9b848a73099e23fa27e025ccc34b961a5bf0db 100644 (file)
@@ -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)
This page took 0.08229 seconds and 5 git commands to generate.