Re: does this dynamic_cast<> bug know?



Bowie Owens wrote:

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:

Damn why I not tried that? :-)



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.

Yep. Now it function properly. Actually one more similar place to fix in orbitcpp/idl-compiller/types/IDLUnion.h

Thanks!




Alexander Nedotsukov wrote:

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.



_______________________________________________
orbitcpp-list mailing list
orbitcpp-list gnome org
http://mail.gnome.org/mailman/listinfo/orbitcpp-list









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