does this dynamic_cast<> bug know?



Hi,

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/types.cc. 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 =
scope.lookup(idlGetQualIdentifier(typespec));
               if (!item) throw
IDLExUnknownIdentifier(typespec,idlGetQualIdentifier(typespec));
               if (!item->isType()) throw
IDLExTypeIdentifierExpected(typespec,IDL_IDENT(typespec).str);
               type = dynamic_cast<IDLType *>(item);
               break;
           }

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 {};

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

All the best,
Alexander.






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