From 23f4e590fb4ce718e58cd736c19d7e6959429500 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 9 Aug 2016 10:08:33 -0400 Subject: [PATCH] PR c++/56701 - wrong type of &*this * typeck.c (cp_build_addr_expr_1): Remove special *this handling. From-SVN: r239285 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 5 ----- gcc/testsuite/g++.dg/cpp0x/rv-this2.C | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-this2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1f032c7b81e..7b746ca67fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-08-09 Jason Merrill + + PR c++/56701 + * typeck.c (cp_build_addr_expr_1): Remove special *this handling. + 2016-08-09 Jakub Jelinek PR c++/72809 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 78d443b1abf..bedc453a945 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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 index 00000000000..fcfd265d0d2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv-this2.C @@ -0,0 +1,8 @@ +// PR c++/56701 +// { dg-do compile { target c++11 } } + +struct A +{ + void f(){ A*&& a = &*this; } +}; +int main(){} -- 2.30.2