This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

New C++ test


This is from a PR I've closed.

Neil.

	* g++.old-deja/g++.other/overload12.C

Index: g++.old-deja/g++.other/overload12.C
===================================================================
RCS file: overload12.C
diff -N overload12.C
--- /dev/null	Tue May  5 13:32:27 1998
+++ overload12.C	Sun Nov 26 09:25:47 2000
@@ -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& 
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]