KDE/kdevplatform/language/duchain

Andreas Pakulat apaku at gmx.de
Wed Oct 8 21:01:53 UTC 2008


On 08.10.08 22:17:57, David Nolden wrote:
> Am Mittwoch, 8. Oktober 2008 18:52:05 schrieb Andreas Pakulat:
> > On 08.10.08 15:34:08, David Nolden wrote:
> > > SVN commit 869243 by zwabel:
> > >
> > > Use static_cast instead of an unsafe reinterpret_cast.
> > > This makes the c++ duchaintest succeed after manuel added his tests, and
> > > might as well fix several other inconsistency problems.
> >
> > Now this won't compile anymore on MSVC. It would help if you'd checked who
> > changed the code from static_cast to reinterpret_cast. As soon as I get
> > around to it, I'll rebuild and post the exact error message, but it boils
> > down to msvc not being able to cast the return of Base::d_func() to that
> > Data class, because they're not related.
> >
> > Andreas
> 
> Ah I see it was you. I was wondering when I saw it why I used it, because it's 
> not safe. Well, as you see gcc is clever enough to do the static_cast here, 
> and I don't see why a compiler should not know how to do that. Of course the 
> classes are related, one is derived from the other. It's just casting "down" 
> the inheritance order instead of "up", it needs some offsets applied that 
> reinterpret_cast does not do. But for windows you can try using a standard 
> c-cast, like "return (Data*)d_func()", I think that also applies the offsets. 
> If that works, we can just use that.

Hmm, I think its either the typedef, or the template parameter thats
confusing msvc. Because the template parameter has the same name as the
typedef in the Base class. 

So I changed it to be a c-style-cast to AbstractFunctionDeclarationData*,
which works. Is that ok for you?

Andreas

-- 
Someone is speaking well of you.

How unusual!




More information about the KDevelop-devel mailing list