This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


945. Use of this in a late-specified return type

Section: _N4567_.5.1.1  [expr.prim.general]     Status: C++11     Submitter: Alisdair Meredith     Date: 18 July, 2009

(Moved from issue 760.)

Although it was considered and rejected as part of issue 643, more recent developments may argue in favor of allowing the use of this in a late-specified return type. In particular, declaring the return type for a forwarding function in a derived class template that invokes a member function of a dependent base class is difficult without this facility. For example:

    template <typename T> struct derived: base<T> {
      auto invoke() -> decltype(this->base_func()) {
        return this->base_func();

(See also issue 1207 for another potential motivation for a change to this rule.)

Additional note (October, 2010):

The question should also be considered for parameter types; for example,

class comparable {
   bool is_equal(decltype(*this) other) { // should be X&
       return /*...*/;

Proposed resolution (March, 2011):

This issue is resolved by the resolution of issues 1017 and 1207 in document N3282.