<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102547>102547</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] undefined behaviour in std::set/std::map/std::unordered_set/std::unordered_map
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hanickadot
</td>
</tr>
</table>
<pre>
I was implementing P3372 (constexpr containers and adaptors) in libc++ and found UB which fails evaluation in ExprConstant.cpp.
It's in these two files:
[`libcxx/include/__tree`](https://github.com/llvm/llvm-project/blob/main/libcxx/include/__tree#L1808-L1815)
[`libcxx/include/__hash_table`](https://github.com/llvm/llvm-project/blob/main/libcxx/include/__hash_table#L1813-L1820)
These are similar issue where a node / bucket is allocated, but NOT constructed, and then a subobject is constructed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0U8GOozgQ_RpzKXUERQjkwKHTWaSWWrt76D1HZbsI3jY2sk2S_fsVTM8kGmk0msNcjEzVc71X9YpiNGfH3IrqIKpjRnMafGgHckZ9kPYpk17_177ClSKYcbI8skvGneHvsqwRBDbKu5j4NgVQ3iUyjkMEchpI05R8iAL3YBxYI5XAg8DDGu397DT8c4DrYNQAPRkbgS9kZ0rGuwXxx20KL8vr5NJGTdNG5EeRP385X5PAOi5paeDIkK4eemM5ivIzY5G0y5eyt5vAzjhlZ80Cu9MpBWaxy0V1FNgMKU0rCjuB3dmkYZYb5UeBnbWXr5-nKfh_WSWBnbReCuxGMm4J_rAAlm9FkzdPb0VTVAL3P6U1UBxOiaT9veQeyqwUi3KhiPmd4nq-r32lwBDNaCwFMDHODNeBAwOB85pBYAdyVh-cwEQga72ixFrgC8g5wZ9_vcNqkDCrz9_L8NPADgjiLL1ceC_Yh7RNpttS78s9ZdwWNZZFVe_zXTa0-X6r-h3WBdVKkWz2dV2Vsi_qule4kyozLea4zZu8Qawa3G1IU18X21oV213f6Epscx7J2M3St40P52xV1RY5Vts6syTZxnUdEO-WFYjLeoR27bacz1Fsc2tiivd3kkl2XaQHWHWE2WnujWMNkge6GD-HxbUx6WWs5XPkZWzfriNNj9fZ-aA5sD59l3cPjDRlc7DtL1tlFR4Fdp_aLy3-HwAA__95aE14">