PR c++/56701 - wrong type of &*this
authorJason Merrill <jason@redhat.com>
Tue, 9 Aug 2016 14:08:33 +0000 (10:08 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 9 Aug 2016 14:08:33 +0000 (10:08 -0400)
* typeck.c (cp_build_addr_expr_1): Remove special *this handling.

From-SVN: r239285

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

index 1f032c7b81e445fb699220956ba77a3131250f9d..7b746ca67fe7a99aba0e74b49a4d96167d325762 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-09  Jason Merrill  <jason@redhat.com>
+
+       PR c++/56701
+       * typeck.c (cp_build_addr_expr_1): Remove special *this handling.
+
 2016-08-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/72809
index 78d443b1abf905b1f1dd9c86d2dbcd375ca6d11c..bedc453a945ca62593052be6cd3e6579f0249353 100644 (file)
@@ -5626,11 +5626,6 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
   /* Let &* cancel out to simplify resulting code.  */
   if (INDIRECT_REF_P (arg))
     {
-      /* We don't need to have `current_class_ptr' wrapped in a
-        NON_LVALUE_EXPR node.  */
-      if (arg == current_class_ref)
-       return current_class_ptr;
-
       arg = TREE_OPERAND (arg, 0);
       if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE)
        {
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-this2.C b/gcc/testsuite/g++.dg/cpp0x/rv-this2.C
new file mode 100644 (file)
index 0000000..fcfd265
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/56701
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  void f(){ A*&& a = &*this; }
+};
+int main(){}