diff options
author | Neil Booth <neil@gcc.gnu.org> | 2000-11-26 17:26:59 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2000-11-26 17:26:59 +0000 |
commit | e1085962754472b391d366d591f66e2413c8faa7 (patch) | |
tree | 1f2a4d69ce67399acdf75a8cf32ad734261a7364 /gcc/testsuite | |
parent | 25080928b1f955e7334139039505892adf290855 (diff) | |
download | gcc-e1085962754472b391d366d591f66e2413c8faa7.zip gcc-e1085962754472b391d366d591f66e2413c8faa7.tar.gz gcc-e1085962754472b391d366d591f66e2413c8faa7.tar.bz2 |
* g++.old-deja/g++.other/overload12.C
From-SVN: r37760
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/overload12.C | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload12.C b/gcc/testsuite/g++.old-deja/g++.other/overload12.C new file mode 100644 index 0000000..7e546da --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overload12.C @@ -0,0 +1,30 @@ +// Build don't link: +// 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& +} |