aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/overload14.C
blob: 2a50b1bf5104e9ed9ee29b70e738bd7bc319780b (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
// { dg-do run  }
// { dg-options "-Wconversion" }
extern "C" void abort();

struct A {
  typedef double (&B);
  typedef const double (&C);

  A() { }

  operator C () const;
  operator B ();
};

static const double d = 2.0;
static double e = 3.0;

A::operator A::C () const
{
  abort ();
  return d;
}

A::operator A::B ()
{
  return e;
}

int main ()
{
  (A::C) A ();
  return 0;
}