[Bug c++/56701] New: The *this* pointer fails to bind to rvalue reference to pointer type

gdjss2728 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 23 22:38:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56701

             Bug #: 56701
           Summary: The *this* pointer fails to bind to rvalue reference
                    to pointer type
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gdjss2728@gmail.com


The following fails to compile with gcc 4.8.0:

struct A
{
  void f(){ A*&& a = this; }
};
int main(){}

Error messages:
error: invalid initialization of reference of type 'A*&&' from expression of
type 'A* const'
void f(){ A*&& a = this; }


According to 9.3.2p1, the this pointer is a prvalue of type A*, not A* const as
the error message suggests.



More information about the Gcc-bugs mailing list