mcf@trlamct.trl.oz.au (Michael Flower) (11/01/90)
I have what I suspect is a bug with the AT&T C++ compiler release 2.1. The following piece of code demonstrates the problem. With line 1 in class Object uncommented and line 2 commented out the compiler objects correctly, that variable a in main() is an instance of an abstract class, ie: t.c", line 21: error: declaration of object of abstract class Object 1 error (line 21 refers to the line "Object a;" in main()). With line 2 in class object uncommented and line 1 commented out the code compiles without error. class Parsable { public: virtual void parse() = 0; virtual void write_out() = 0; }; class Object : public virtual Parsable { public: //virtual void draw() {}; /* 1 */ //void draw() {}; /* 2 */ }; main(){ Object a; } Using the g++ compiler Version 1.27, the compiler doesn't object to either form of the program however the linker flags the two undefined symbols created by the deferred functions parse() and write_out(). Is the AT&T compiler in error here or am I in error? Shouldn't it complain about the declaration of a in both cases. Shouldn't the g++ compiler complain of the declaration of an object of an abstract class. (perhaps it should and has been fixed in subsequent releases?). What is the current GNU c++ release? Needless to say, I had 'a' declared (supposedly) satisfactorily, until I made some trivial change to class Object and I was told about my declaration of an object of an abstract class. Cheers ...mcf Michael Flower Artificial Intelligence Systems Email: flower@trl.oz.au Telecom Research Laboratories Voice: +61 3 541 6179 Melbourne, AUSTRALIA Fax: +61 3 543 8863