On Mar 20, 2013, at 4:26 PM, Alexander Zinenko <fty...@gmail.com> wrote: > Thanks for your comments and sorry that it's taking so long to polish my code. > Please find the updated version attached. > > On 20 March 2013 07:02, John McCall <rjmcc...@apple.com> wrote: > On Mar 14, 2013, at 8:47 AM, Alexander Zinenko <fty...@gmail.com> wrote: >> Thanks for review! >> >> I attached a quiet version of a patch that doesn't warn if any of the paths >> is a non-virtually-derived base at offset zero. >> During first iteration, Jordan proposed to make a separate switch to enable >> a noisy version that warns even if the cast is safe, though. If it is still >> required, it can be easily added back. >> Processing multiple base paths made checking a bit heavier, but I see no >> other approach. > > + if(!SrcRD || !SrcRD->hasDefinition()) > + return; > + > + const CXXRecordDecl *DestRD = DestType->getPointeeCXXRecordDecl(); > + > + if(!DestRD || !DestRD->hasDefinition()) > + return; > > Please add a comment saying that we're deliberately not instantiating > templates here because we're not allowed to. > Actually, we do not call CheckReinterpretCast if the cast is type-dependent.
I don't see your point. Whether the cast is type-dependent has nothing to do with it. Both arguments could be non-dependent, or we could actually be in a non-template context, and it'd still be illegal to instantiate the classes. For example: template <class T> class A { T val; }; class B {}; B *foo(A<void> *a) { return reinterpret_cast<B*>(a); } John.
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits