OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [trailing1.C] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Tests for late-specified return type.
2
// { dg-options "-std=c++0x -fabi-version=5" }
3
 
4
auto f() -> int
5
{
6
  return 0;
7
}
8
 
9
template
10
auto add(T t, U u) -> decltype (t+u)
11
{
12
  return t+u;
13
}
14
 
15
template
16
decltype(T()+U()) add2(T t, U u)
17
{
18
  return t+u;
19
}
20
 
21
template 
22
U ag (T, U)
23
{
24
  return U();
25
}
26
 
27
template
28
auto add3(T t, U u) -> decltype (ag(t,u))
29
{
30
  return ag(t,u);
31
}
32
 
33
template
34
decltype(*(T*)0+*(U*)0) add4(T t, U u)
35
{
36
  return t+u;
37
}
38
 
39
template 
40
struct A
41
{
42
  T f() {}
43
  template 
44
  T g() {}
45
  template 
46
  struct B
47
  {
48
    int MEM;
49
  };
50
};
51
 
52
template 
53
auto f(T* t) -> decltype (t->f())
54
{
55
  return t->f();
56
}
57
 
58
template 
59
auto g(T t) -> decltype (t.f())
60
{
61
  return t.f();
62
}
63
 
64
template 
65
auto h(T t, U u) -> decltype (t.template g())
66
{
67
  return t.template g();
68
}
69
 
70
struct D { };
71
struct C: public A::B
72
{
73
};
74
 
75
template 
76
auto k(T t, U u, V v) -> decltype (t.U::template B::MEM)
77
{
78
  return t.U::template B::MEM;
79
}
80
 
81
template 
82
auto l(T t) -> decltype (t)
83
{
84
  return t;
85
}
86
 
87
template 
88
auto m(T t) -> decltype (u)
89
{
90
  return t;
91
}
92
 
93
A a, *p;
94
 
95
int main()
96
{
97
  // { dg-final { scan-assembler  "_Z3addIidEDTplfp_fp0_ET_T0_" } }
98
  auto i = add(1, 2.0);
99
  // { dg-final { scan-assembler "_Z4add4IidEDTpldecvPT_Li0EdecvPT0_Li0EES0_S2_" } }
100
  auto i4 = add4(1, 2.0);
101
  // { dg-final { scan-assembler "_Z4add2IidEDTplcvT__EcvT0__EES0_S1_" } }
102
  auto i2 = add2(1, 2.0);
103
  // { dg-final { scan-assembler "_Z4add3IidEDTcl2agfp_fp0_EET_T0_" } }
104
  auto i3 = add3(1, 2.0);
105
  // { dg-final { scan-assembler "_Z1fI1AIiEEDTclptfp_1fEEPT_" } }
106
  f(p);
107
  // { dg-final { scan-assembler "_Z1gI1AIiEEDTcldtfp_1fEET_" } }
108
  g(a);
109
  // { dg-final { scan-assembler "_Z1hI1AIiEdEDTcldtfp_1gIT0_EEET_S2_" } }
110
  h(a,1.0);
111
  // { dg-final { scan-assembler "_Z1kI1C1AIiE1DEDtdtfp_srNT0_1BIT1_EE3MEMET_S4_S6_" } }
112
  k( C(), A(), D() );
113
  // { dg-final { scan-assembler "_Z1lIiEDtfp_ET_" } }
114
  l(1);
115
  // { dg-final { scan-assembler "_Z1mIiLi1EEDtT0_ET_" } }
116
  m(1);
117
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.