[llvm-dev] RTTI with smart pointers

Victor Campos via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 31 05:43:12 PDT 2017


Hi,

I would like to use std::shared_ptr in my pass. However I'm facing a
problem wrt RTTI. If I have a code like:

std::shared_ptr<BaseClass> x(new DerivedClass());
...
std::shared_ptr<DerivedClass> p =
std::dynamic_pointer_cast<DerivedClass>(x);

It does not compile since the default RTTI infrastructure is not used by
LLVM. Also, it's not clear to me if the 'classof' approach works in this
case (I did try it with no success).

Is it possible to have a dynamic_cast using std smart pointers in LLVM?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170731/3aadeacf/attachment.html>


More information about the llvm-dev mailing list