summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/overload12.C
blob: 2e37f07c998b1a02ba2bb309c528cb868a47132c (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
// { dg-do assemble  }
// Origin: Neil Booth <neilb@earthling.net> from bug #27.

struct A{};

struct B:A{};

struct C:B{};

struct CX
{
  C  c;

  operator C&(){return c;}
};

// viable functions for call below
void f(A&);
void f(B&);

int main()
{
  CX cx;
  C  c;

  f(c);   // the standard conversion to B& is better than to A& 

  f(cx);  // after user defined conversion to C&
  // the standard conversion to B& is better than to A& 
}