Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!cadnetix.COM!mitch From: mitch@cadnetix.COM Newsgroups: comp.lang.c++,local.c++ Subject: C++ 2.0 bug? Message-ID: <10531@cadnetix.COM> Date: 12 Dec 89 22:15:37 GMT Sender: news@cadnetix.COM Reply-To: mitch@cadnetix.COM () Organization: Cadnetix Corp., Boulder, CO Lines: 58 I am posting the following for a friend, who does not currently have access to the net news, but will soon. If anyone has any info/answers/comments on this, would you please EMAIL REPLIES to me, as I do not read this newsgroup (so little time, too much to do). ================== Included Query Begins Here ================== Will the following code compile on Sun's C++ compiler? The compilers we have here (ATT and Oregon Software) get the following error: "foo.cxx", line 12: error: FOO ::~FOO () with return type The Oregon Software compiler doesn't like the friend constructor either. An easy, if sloppy, workaround is to make the entire class FOO a friend of BAR. Looking at the source for cfront, I found the following comment: // define friends defined inline and modify return types if necessary It would appear that they sometimes tweek the return types of friend functions, not a nice thing to do if the function is not supposed to have a return type, as is the case with destructors. It is really too bad ATT wants all that money for support :( We are supposed to get our fast modem before the end of the year but until then could you pass this on to comp.lang.c++ to see if anyone else knows about this? Thanx. ----------- Code Sample - cut here ---------------- class FOO { public: FOO() { }; ~FOO() { }; }; class BAR { public: friend FOO::FOO(); friend FOO::~FOO(); }; ===================== End of Included Query =================== Thanks for your input. Note that I tried this myself using Sun's C++ 2.0 compiler, and (as I expected) got the same error message. Responses can be emailed to me at the address listed below. -Mitch Mitch Black UUCP: ..!{uunet,boulder}!cadnetix!mitch Daisy/Cadnetix Corp. Internet: mitch@cadnetix.com 5775 Flatiron Pkwy. Boulder, CO 80301 Voice: (303) 444-8075