OSDN Git Service

2012-05-16 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr53364.C
1 // { dg-do run }
2
3 extern "C" void abort (void);
4
5 template<typename _Tp>
6 inline const _Tp&
7 min(const _Tp& __a, const _Tp& __b)
8 {
9   if (__b < __a)
10     return __b;
11   return __a;
12 }
13
14 struct A
15 {
16   int m_x;
17
18   explicit A(int x) : m_x(x) {}
19   operator int() const { return m_x; }
20 };
21
22 struct B : public A
23 {
24 public:
25   explicit B(int x) : A(x) {}
26 };
27
28 int data = 1;
29
30 int main()
31 {
32   B b = B(10);
33   b = min(b, B(data));
34   if (b != 1)
35     abort ();
36   return 0;
37 }