Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.other/overload12.C

raw
1 // { dg-do assemble }
2 // Origin: Neil Booth <[email protected]> from bug #27.
3
4 struct A{};
5
6 struct B:A{};
7
8 struct C:B{};
9
10 struct CX
11 {
12 C c;
13
14 operator C&(){return c;}
15 };
16
17 // viable functions for call below
18 void f(A&);
19 void f(B&);
20
21 int main()
22 {
23 CX cx;
24 C c;
25
26 f(c); // the standard conversion to B& is better than to A&
27
28 f(cx); // after user defined conversion to C&
29 // the standard conversion to B& is better than to A&
30 }