[cxx-abi-dev] Mangling 'this' in trailing-return-type

Jason Merrill jason at redhat.com
Mon Jul 4 14:32:06 UTC 2011


On 07/01/2011 11:44 PM, Jason Merrill wrote:
> Since DR 1207, we need to have a representation for uses of 'this' in a
> trailing-return-type. Perhaps "fpT"?

So,

struct B
{
   template <class U> U f();
};

struct A
{
   B b;
   // implicitly rewritten to (*this).b.f<U>()
   // _ZN1A1fIiEEDTcldtdtdefpT1b1fIT_EEEv
   template <class U> auto f() -> decltype (b.f<U>());
   // _ZN1A1gIiEEDTcldtptfpT1b1fIT_EEEv
   template <class U> auto g() -> decltype (this->b.f<U>());
};

int main()
{
   A a;
   a.f<int>();
   a.g<int>();
}



More information about the cxx-abi-dev mailing list