<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/119016>119016</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Should std::flat_set::insert construct a temporary value in its implementation?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            huixie90
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ldionne
      </td>
    </tr>
</table>

<pre>
    From https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2767r2.html#insert-emplace:

```c++
std::pmr::set_default_resource(std::pmr::null_memory_resource());
std::pmr::monotonic_buffer_resource mr(1’000’000);

auto fm = PmrFlatSet<std::pmr::string>(&mr);
std::pmr::string ps("too long to fit in the small string buffer", &mr);
fm.insert(ps);
  // Before: runtime abort, cannot default-allocate t
  // After: OK

```

I don't know how libc++ handles this today and I don't know what we *want* to do with it, but we must investigate and decide on *something*.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VNuO4zYM_RrlhUgg0xM7fvBDZmYNFH1ogf2AQJboWFtdDIked_6-UJK9zO4WIGARPjwieUipnO01EPXi-CwQ59X-a6mTAlEcX3dq5Tmm3hkbQ6DdGM17P6ToYWZesqjPAgeBw7Zth7hQ2Gc2h5iuAocvrCuBQ9aIBXDF4pmos8BhUQulckCJdfGxbdqEh5m9E1jbkCnxnvzilKZyibxZI--mBT4Xk-fMpvyuz4tP90Mmvhia1Or4kijHNWkSePoVGFbnLp58TO8_AgV2xerfs_sYIsdg9WVcp4nSt0jwSeCpEp9QnKToOinlh_NXSiHPauUIkwdRv8LfPg1O8WdiUb_8phhONlxF_emWWFPu-N_U7lhY8g2LHCO4GK5QLrMMNgDPBNkr5-CBvddQlMYX-Mg_-cNdBYGnQvk1_RcUZwl30eGZppiKPpDWwNYTqDGWkBfQKoTI8FBir5yLWjEB_0JynphKCfDXnz_JfHf_ABODwJbhnxA3mOMGzo6PEYBZBeMoA882A0ej3kEFAz8FbbNi2AgEnjcVWOC5tMVE2CzPYG8Zj-sN4tdcmvVGme21ZFzoDGlrCGIoDDl64rnogufDzvS16epO7aiv2ro-Vk_yWO3mvu1Ua7Bp6aSnoznqkZq2a5ua6FQ1uqWd7VHiU4WyqboSc5BVq9FMKLsjNXocxZMkr6w7OPfmy1LtbM4r9VXVyarZOTWSy4-t_d6Rx96mvkTtx_WaxZN0NnP-zsOW3W3ffwg7vsLnOa7OwLfRmpziSy6jWbz7OICOIXNaNYMCJr_EpNI7vCm3UpkxyxmsXxx5CqzYxiDqYbcm1398MK6W53U86OgFDiWxx2e_pPiFNAscbtWWR-JR8FuP_wUAAP__3OBwdQ">