[Bug c++/49003] [C++0x] decltype in member function's trailing return type should deduce constness of *this

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 16 15:15:00 GMT 2011


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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-16 14:48:13 UTC ---
A simpler test for DR 1207 being implemented is:

struct A {
    auto a() const -> decltype(this) { return this; }
};

nc.cc:2:32: error: invalid use of 'this' at top level
nc.cc:2:32: error: invalid use of 'this' at top level

The late-specified return type should be accepted with the same type as the
return statement's expression i.e. const A*



More information about the Gcc-bugs mailing list