]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/g++.dg/cpp0x/trailing3.C
re PR c++/6057 (expression mangling doesn't work for operator new)
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / trailing3.C
1 // More auto/decltype mangling tests.
2 // { dg-options "-std=c++0x -fabi-version=0" }
3
4 template <class T>
5 struct B
6 {
7 static int i;
8 };
9
10 int&& x();
11
12 template <class T>
13 struct A
14 {
15 static int i;
16 static int &ir;
17 static int &&irr;
18 template <class U>
19 auto f(U u) -> decltype (u + i);
20 template <class U>
21 auto fr(U u) -> decltype (u + ir);
22 template <class U>
23 auto frr(U u) -> decltype (u + irr);
24 template <class U>
25 auto g(U u) -> decltype (u + sizeof (i));
26 template <class U>
27 auto h(U u) -> decltype (u + B<U>::i);
28 template <class U>
29 auto j(U u) -> decltype (u + x());
30 };
31
32 template<class T> template<class U>
33 auto A<T>::f(U u) -> decltype (u + i)
34 {
35 return u + i;
36 }
37
38 template <class... Args>
39 int f (Args... args);
40
41 template <class... Args>
42 auto g (Args... args) -> decltype (f ((args+1)...))
43 {
44 return (f ((args+1)...));
45 }
46
47 int main()
48 {
49 // { dg-final { scan-assembler "_ZN1AIiE1fIiEEDTplfp_L_ZNS0_1iEEET_" } }
50 A<int>().f(1);
51 // { dg-final { scan-assembler "_ZN1AIiE2frIiEEDTplfp_L_ZNS0_2irEEET_" } }
52 A<int>().fr(1);
53 // { dg-final { scan-assembler "_ZN1AIiE3frrIiEEDTplfp_L_ZNS0_3irrEEET_" } }
54 A<int>().frr(1);
55 // { dg-final { scan-assembler "_ZN1AIiE1gIiEEDTplfp_szL_ZNS0_1iEEET_" } }
56 A<int>().g(1);
57 // { dg-final { scan-assembler "_ZN1AIiE1hIiEEDTplfp_sr1BIT_E1iES3_" } }
58 A<int>().h(1);
59 // { dg-final { scan-assembler "_ZN1AIiE1jIiEEDTplfp_clL_Z1xvEEET_" } }
60 A<int>().j(1);
61 // { dg-final { scan-assembler "_Z1gIJidEEDTcl1fspplfp_Li1EEEDpT_" } }
62 g(42, 1.0);
63 }
This page took 0.040203 seconds and 5 git commands to generate.