Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!emory!mephisto!ncsuvx!mcnc!thorin!jason!tuck From: tuck@jason.cs.unc.edu (Russ Tuck) Newsgroups: comp.lang.c++ Subject: Re: user-defined conversion--bug or error? Keywords: user-defined conversion, cfront 2.0, g++ 1.36.1 Message-ID: <10993@thorin.cs.unc.edu> Date: 6 Dec 89 18:33:36 GMT References: <10986@thorin.cs.unc.edu> Sender: news@thorin.cs.unc.edu Reply-To: tuck@jason.cs.unc.edu (Russ Tuck) Organization: University Of North Carolina, Chapel Hill Lines: 74 Simplifying my earlier program slightly gave interesting results. First, I removed all the "const" keywords, to make it legal C++ 1.2. With this change, AT&T cfront 1.2 compiled it without error (but 2.0 gave the same error). Then I deleted the "&" chars, so + and conversions use valuess instead of references. This finally compiled without error with cfront 2.0 (as well as 1.2 and g++). This suggests that the problem is in cfront 2.0. Any comments? Suggestions?? Here are the details... CC.new = AT&T cfront 2.0 CC = AT&T cfront 1.2 g++ = GNU g++ 1.36.1 piglet = Sun-3/60, SunOS 4.0.3 (no const, keep ref &) tuck@piglet> cat type2ac.C class A { public: friend A operator+ (A& lsrc, A& rsrc); }; class B { public: B(); operator A&(); }; main() { A a0; B b0, b1; a0 = b0 + b1; // legal??? } tuck@piglet> CC.new -c type2ac.C CC type2ac.C: "type2ac.C", line 17: error: ambiguous use of overloaded +: B and B 1 error tuck@piglet> CC -c type2ac.C tuck@piglet> g++ -c type2ac.C tuck@piglet> (no const, no ref &) tuck@piglet> cat type2ad.C class A { public: friend A operator+ (A lsrc, A rsrc); }; class B { public: B(); operator A(); }; main() { A a0; B b0, b1; a0 = b0 + b1; // legal??? } tuck@piglet> CC.new -c type2ad.C CC type2ad.C: cc -c type2ad.c tuck@piglet> CC -c type2ad.C tuck@piglet> g++ -c type2ad.C tuck@piglet>