summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/overload12.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/overload12.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/overload12.C30
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 000000000..2e37f07c9
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/overload12.C
@@ -0,0 +1,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&
+}