[cfe-dev] Derived Class in BaseToDerived static cast

Sebastian Würl via cfe-dev cfe-dev at lists.llvm.org
Sat Dec 3 02:58:24 PST 2016


Hello,

If i have a static_cast<D>(b): is the 'real' class of D, which b will 
be casted to at runtime, known at compile-time? In CodeGen/CGExpr.cpp 
the explicit case "BaseToDerived" is handled and you can retrieve 
TypeSourceInfo using the function getTypeInfoAsWritten(). It seems that 
this information enough to get the exact type of this cast at 
compile-time and should also work for Template programming, as my 
understanding is that clang should have abstracted the code into 
specific types at this point. Am I wrong here?
Is there any case where the type is not known at compile time? Can the 
'real' type be hidden behind a pointer?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161203/e699d0c4/attachment.html>


More information about the cfe-dev mailing list