<div dir="auto"><div>The relevant implementation of exception_ptr is here (<a href="https://github.com/llvm-mirror/libcxx/blob/master/src/support/runtime/exception_pointer_cxxabi.ipp">https://github.com/llvm-mirror/libcxx/blob/master/src/support/runtime/exception_pointer_cxxabi.ipp</a>)</div><div dir="auto"><br></div><div dir="auto">The exception header is reference counted, my very quick and dirty reading of the implementation suggests that we handle the reference counting correctly.</div><div dir="auto"><br></div><div dir="auto">please let me know if I've overlooked something.</div><div dir="auto"><br></div><div dir="auto"><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, Nov 18, 2019, 9:34 PM Shoaib Meenai via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank" rel="noreferrer">libcxx-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">According to cppreference [1]:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">> The exception object referenced by an std::exception_ptr remains valid as long as there remains at least one std::exception_ptr that is referencing it: std::exception_ptr is a shared-ownership smart pointer<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I don’t actually see any code in libc++’s implementation to prolong the lifetime of an exception object in case there are exception_ptrs pointing to it. I feel like I’m missing something obvious; how is this
 case handled?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">[1] <a href="https://en.cppreference.com/w/cpp/error/exception_ptr" rel="noreferrer noreferrer" target="_blank">https://en.cppreference.com/w/cpp/error/exception_ptr</a><u></u><u></u></span></p>
</div>
</div>

_______________________________________________<br>
libcxx-dev mailing list<br>
<a href="mailto:libcxx-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank">libcxx-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</a><br>
</blockquote></div>
</div></div>