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