1 // More auto/decltype mangling tests. 2 // { dg-do compile { target c++11 } } 3 // { dg-options "-fabi-version=0" } 4 5 template <class T> 6 struct B 7 { 8 static int i; 9 }; 10 11 int&& x(); 12 13 template <class T> 14 struct A 15 { 16 static int i; 17 static int &ir; 18 static int &&irr; 19 template <class U> 20 auto f(U u) -> decltype (u + i); 21 template <class U> 22 auto fr(U u) -> decltype (u + ir); 23 template <class U> 24 auto frr(U u) -> decltype (u + irr); 25 template <class U> 26 auto g(U u) -> decltype (u + sizeof (i)); 27 template <class U> 28 auto h(U u) -> decltype (u + B<U>::i); 29 template <class U> 30 auto j(U u) -> decltype (u + x()); 31 }; 32 33 template<class T> template<class U> 34 auto A<T>::f(U u) -> decltype (u + i) 35 { 36 return u + i; 37 } 38 39 template <class... Args> 40 int f (Args... args); 41 42 template <class... Args> 43 auto g (Args... args) -> decltype (f ((args+1)...)) 44 { 45 return (f ((args+1)...)); 46 } 47 main()48int main() 49 { 50 // { dg-final { scan-assembler "_ZN1AIiE1fIiEEDTplfp_L_ZNS0_1iEEET_" } } 51 A<int>().f(1); 52 // { dg-final { scan-assembler "_ZN1AIiE2frIiEEDTplfp_L_ZNS0_2irEEET_" } } 53 A<int>().fr(1); 54 // { dg-final { scan-assembler "_ZN1AIiE3frrIiEEDTplfp_L_ZNS0_3irrEEET_" } } 55 A<int>().frr(1); 56 // { dg-final { scan-assembler "_ZN1AIiE1gIiEEDTplfp_szL_ZNS0_1iEEET_" } } 57 A<int>().g(1); 58 // { dg-final { scan-assembler "_ZN1AIiE1hIiEEDTplfp_sr1BIT_E1iES3_" } } 59 A<int>().h(1); 60 // { dg-final { scan-assembler "_ZN1AIiE1jIiEEDTplfp_clL_Z1xvEEET_" } } 61 A<int>().j(1); 62 // { dg-final { scan-assembler "_Z1gIJidEEDTcl1fspplfp_Li1EEEDpT_" } } 63 g(42, 1.0); 64 } 65