aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53364.C
blob: 36bb083e828cad5a4d073ac17b63f1fdd790c4ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// { dg-do run }

extern "C" void abort (void);

template<typename _Tp>
inline const _Tp&
min(const _Tp& __a, const _Tp& __b)
{
  if (__b < __a)
    return __b;
  return __a;
}

struct A
{
  int m_x;

  explicit A(int x) : m_x(x) {}
  operator int() const { return m_x; }
};

struct B : public A
{
public:
  explicit B(int x) : A(x) {}
};

int data = 1;

int main()
{
  B b = B(10);
  b = min(b, B(data));
  if (b != 1)
    abort ();
  return 0;
}