From: neil Date: Sun, 26 Nov 2000 17:26:59 +0000 (+0000) Subject: * g++.old-deja/g++.other/overload12.C X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7302865bf8517375d18bbd72b77187ce66ff6f4f;p=thirdparty%2Fgcc.git * g++.old-deja/g++.other/overload12.C git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37760 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 000000000000..7e546da8626b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overload12.C @@ -0,0 +1,30 @@ +// Build don't link: +// Origin: Neil Booth 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& +}