<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/142066>142066</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] v2 ABI silently introduces new non-conforming behaviour for smart pointer destruction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jrtc27
</td>
</tr>
</table>
<pre>
_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI and _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI are enabled for libc++'s v2 ABI and above (and unstable ABI). As documented in libcxx/docs/DesignDocs/UniquePtrTrivialAbi.rst (but that does not mention it's enabled by default for v2 and above), this is a non-conforming implementation that can lead to destructors being called in an order not permitted by the standard. Whilst I understand the appeal of the performance gain these options give, libc++ should not deliberately and silently be regressing standards conformance in the name of performance as part of opting into its v2 ABI. I would consider this a blocker for FreeBSD ever adopting that new ABI; we've had enough pain from adopting libc++ before it had a conforming std::pair implementation and having to maintain and keep providing that non-conformance for ABI compatibility despite it breaking real-world software. Maybe this one is harmless in practice, but any non-conformance has the potential to cause problems, and this would be a strict regression over v1.
These options should be split out from the ABI version, as an explicit opt-in for platforms to use should they view the performance gain worth the non-conformance. libc++'s v2 ABI should by default conform to the specification as fully as possible.
Cc @dim @emaste as it pertains to libc++ in FreeBSD
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0lU1v27oShn-NvBnEcGgriRde2EmMa6C3yG3Te5YBP0bWtBSpQ47k-t8fDG037scBDBiSOMNn3nmH1DnTPiCuqnpT1U8TPXAb0-prYqvuJya64-rtw27z-PLytt7s3p4_rjcfnt--fNz978vz28vrp7fXT7v_79Yf5Cvo4OAPqz__Z_3p-en31QkBgzYeHTQxgSdjK7Upv_sMo4JLTm3iiFCpB3kYQmYJkq-VWk5hncFFO3QYGB1QKIm-f6_U1kW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