]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* g++.old-deja/g++.other/overload12.C
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 26 Nov 2000 17:26:59 +0000 (17:26 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 26 Nov 2000 17:26:59 +0000 (17:26 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37760 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/g++.old-deja/g++.other/overload12.C [new file with mode: 0644]

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 (file)
index 0000000..7e546da
--- /dev/null
@@ -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& 
+}