1 // Testcase for 'this' mangling
2 // { dg-do compile { target c++11 } }
3 
4 struct B
5 {
6   template <class U> U f();
7 };
8 
9 struct A
10 {
11   B b;
12   // { dg-final { scan-assembler "_ZN1A1fIiEEDTcldtdtdefpT1b1fIT_EEEv" } }
13   template <class U> auto f() -> decltype (b.f<U>());
14   // { dg-final { scan-assembler "_ZN1A1gIiEEDTcldtptfpT1b1fIT_EEEv" } }
15   template <class U> auto g() -> decltype (this->b.f<U>());
16   // { dg-final { scan-assembler "_ZN1A1hIiEEDTcldtdtdefpT1bsr1B1fIT_EEEv" } }
17   template <class U> auto h() -> decltype (b.B::f<U>());
18   // { dg-final { scan-assembler "_ZN1A1iIiEEDTcldtptfpT1bsr1B1fIT_EEEv" } }
19   template <class U> auto i() -> decltype (this->b.B::f<U>());
20 };
21 
main()22 int main()
23 {
24   A a;
25   a.f<int>();
26   a.g<int>();
27   a.h<int>();
28   a.i<int>();
29 }
30