<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 31, 2017, at 5:43 AM, Victor Campos via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">Hi,<br class=""><br class=""></div>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:<br class=""><br class=""></div><div class=""><span style="font-family:monospace,monospace" class="">std::shared_ptr<BaseClass> x(new DerivedClass());<br class="">...<br class=""></span></div><div class=""><span style="font-family:monospace,monospace" class="">std::shared_ptr<DerivedClass> p = std::dynamic_pointer_cast<DerivedClass>(x);</span><br class=""><br class=""></div><div class="">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).<br class=""><br class=""></div><div class="">Is it possible to have a dynamic_cast using std smart pointers in LLVM?</div></div></div></blockquote><div><br class=""></div><span class="">I don't know of an off-the-shelf way to do this but you could look to r300098 for inspiration (it introduced unique_dyn_cast).</span></div><div><span class=""><br class=""></span></div><div><span class="">vedant<br class=""></span><span class=""><br class=""></span><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Thanks.<br class=""></div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></body></html>