Re: does this dynamic_cast<> bug know?

Hi Alexander,

Nice work on the bug report. I was able to reproduce the problem with your sample code. It looks like the problem might be easy to fix. Deleting public virtual T from the X base list was sufficient to get the sample working. I don't think IDLStruct needs to directly inherit from IDLType. Please try commenting out the public virtual IDLType in the IDLStruct base class list:

class IDLStruct: public IDLCompound, /*public virtual IDLType,*/ public IDLCompoundSeqElem

Can you confirm that this allows the idl compiler to function properly or at least better.

Alexander Nedotsukov wrote:


I think this may be considered as serious bug in C++ idl compiller
backend when it built with gcc 2.95.x. Look at the file
orbitcpp/idl-compiller/ It contains following pice of code
(actually there is may be much more places like that).

IDLType *
IDLTypeParser::parseTypeSpec(IDLScope &scope,IDL_tree typespec) {
       case IDLN_IDENT:
               IDLElement *item =
               if (!item) throw
               if (!item->isType()) throw
               type = dynamic_cast<IDLType *>(item);

I believe gcc 2.95.x dynamic_cast<> implementation is buggy and if
scope.lookup() return IDLStruct* then dynamic_cast<> two lines bellow
will result in NULL pointer and .idl compilation will be aborted with
the "not yet implemented: idln_ident". Code compilled with gcc 3.2 works
just fine. Here is a small sample that reproduce classes hierarchy
involved in case.

class T {};
class TI { public: virtual void m() {} };
class CS : public virtual T, public virtual TI {};
class E : public virtual TI {};
class S : public E {};
class C : public S {};
class X : public C, public virtual T, public CS {};

 E* e = new X;
 T* t = dynamic_cast<T*>(e);
 delete e;
 return 0;

All the best,

orbitcpp-list mailing list
orbitcpp-list gnome org

Bowie Owens

CSIRO Mathematical & Information Sciences
phone  : +61 3 9545 8055
fax    : +61 3 9545 8080
mobile : 0425 729 875
email  : Bowie Owens csiro au

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]