PR c++/71576 - bitfield and rvalue reference
authorJason Merrill <jason@redhat.com>
Sun, 24 Jul 2016 02:25:36 +0000 (22:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 24 Jul 2016 02:25:36 +0000 (22:25 -0400)
* call.c (convert_like_real): Use lvalue_kind.

From-SVN: r238683

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp0x/rv-bitfield3.C [new file with mode: 0644]

index 75d91082e368e1341c6944287daec4eca13496f4..34ebcb818bf5c6c1c8043332df41ab7c21963d39 100644 (file)
@@ -1,5 +1,8 @@
 2016-07-22  Jason Merrill  <jason@redhat.com>
 
+       PR c++/71576
+       * call.c (convert_like_real): Use lvalue_kind.
+
        PR c++/71748
        PR c++/52746
        * pt.c (tsubst_baselink): Call
index 061e7084d37fc27b01f8e046bc8d3b7703460688..2f373a37b98ea1f3947a401bd764d6d34125a8c5 100644 (file)
@@ -6737,7 +6737,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
               for a non-reference copy-initialization (8.5).  */
 
            tree type = TREE_TYPE (ref_type);
-           cp_lvalue_kind lvalue = real_lvalue_p (expr);
+           cp_lvalue_kind lvalue = lvalue_kind (expr);
 
            gcc_assert (same_type_ignoring_top_level_qualifiers_p
                        (type, next_conversion (convs)->type));
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-bitfield3.C b/gcc/testsuite/g++.dg/cpp0x/rv-bitfield3.C
new file mode 100644 (file)
index 0000000..9d2d872
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/71576
+// { dg-do compile { target c++11 } }
+
+template < typename T > T && foo ();
+
+struct A 
+{
+  int i:5;
+};
+
+void foo ()
+{
+  int &&j = foo < A > ().i;
+}