Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!YAHI.STANFORD.EDU!tiemann From: tiemann@YAHI.STANFORD.EDU (Michael Tiemann) Newsgroups: gnu.g++.bug Subject: G++ 1.34.2 overloaded virtual functions Message-ID: <8904271539.AA02711@yahi.stanford.edu> Date: 27 Apr 89 15:39:52 GMT References: <715@arisia.Xerox.COM> Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@lurch.stanford.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 48 Date: 26 Apr 89 19:55:32 GMT From: arisia!wedekind@lll-winken.llnl.gov (Jerry Wedekind) Organization: Xerox PARC Sender: bug-g++-request@prep.ai.mit.edu Environment: g++ 1.34.2, Sun3 OS4. G++ seems to have a bug with overloaded virtual functions. In the test case: class A { public: virtual void XXX (int); }; class B : public A { public: void XXX (int); void XXX (char); }; It complains: "test.h:9: conficting specification deriving virtual function 'void B::XXX (float)' It should be the case that XXX(int) is virtual in A & B, and XXX is overloaded in B. The situation is clear: if you have an A.XXX(int) use the virtual function table, and if you call B.XXX, you use the overloaded function rules & then virtual (if needed). It doesn't help to make A.XXX overloaded, since it still complains about any new overloaded functions in B. This test case works in g++ 1.32 & Oregon C++. Is this illegal (and two other compilers are wrong), or is there a workaround in 1.34.2? /John arpa: JWenn.esae@Xerox.com uucp: wedekind@arisia.uucp Some people thought that this should be an error, and cfront complains, so I made GNU C++ complain. There will be a flag in 1.35.0, -Woverloaded-virtual which permits this extension. Michael