🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Jerry Wedekind Wed, 26 Apr 1989 19:55
G++ 1.34.2 overloaded virtual functions
#1910
Author: Jerry Wedekind
Date: Wed, 26 Apr 1989 19:55
36 lines
1368 bytes
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
G++ 1.34.2 overloaded virtual functions
#1911
Author: Michael Tiemann
Date: Thu, 27 Apr 1989 15:39
48 lines
1911 bytes
   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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads