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

    <tr>
        <th>Summary</th>
        <td>
            Precondition violations in libc++ tests for std::pmr::polymorphic_allocator
        </td>
    </tr>

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

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

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

<pre>
    https://github.com/llvm/llvm-project/blob/d86c63d8e3ec135aadfb2dd2651f95ba2d74a6ab/libcxx/test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/select_on_container_copy_construction.pass.cpp#L42


https://github.com/llvm/llvm-project/blob/d86c63d8e3ec135aadfb2dd2651f95ba2d74a6ab/libcxx/test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/resource.pass.cpp#L37


I've found a few places where a null `memory_resource*` is passed to a resource or a `polymorphic_allocator`, which is undefined:

[mem.poly.allocator.ctor]:

> `polymorphic_allocator(memory_resource* r);`  
>  
> 2.  _Preconditions_: `r` is non-null.

If this is an intentional libc++ extension then should the tests be guarded with `_LIBCPP_VERSION`, or moved to the libcxx/test/libcxx directory for non-standard features?

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcVE2P2zYQ_TXUZRBBHurLBx3sJAIWCNpFC_QqUOTIYkqRAknZ639f0Pbupm320GsBARyKnMc3bz5ECPpkiTpWHVn1JRNbnJ3vvl_En2Su2ejUtZtjXAPjB4Y9w_6k47yNuXQLw96Y8-vyafXuO8nIsB-NGxn2qq1lzVVLnOSOV0KoaUSlsK52074aBaqmFLVIV40e5csLwz5SSAghKob9FrXRUVN4s68M-4WW3N_-JWt15poLY5wU0flcGhE-OFooUQ1kSMbB2UE6G4W25Afp1mvahug3GbWz-SpCyOW6MuTfSmTF4f79r5TwFNzmJf0tWN68BfvEsDkTTG6zCgRMdIHVCEkBLjN5AgF2MwZYXSy0OH8dXgEZHlhdgA6QkElBdCDg9RScB5G8EqnF-XXWcnjjxuqC4We4zFrOCWGziiZtSSXV78yq48-iTb7Vl_db_OvHb2D7b8bgGe4ZPybm8AB4XTEHGJ49SWeVTvURBsYPCd8_ArXOfkpq5A_pJoizDulEWNA2kk1uwkBKL8MjwyPQSyQbtLMQZ7IQZrcZlWxIqQ8wEpw24RUpuOg4p-eGb0_Hz8_Pwx9ff_v96ddfHmI5D4s733VO7v8sofselPaUZLrC5PyNcYjCKuEVTCTiliqJ96w4ZKrjas_3IqNu11TI923b8Gzu6qKuEPdtK6ipClGrohh3U7MTbUlN046Z7rDAqmh2vNhjU_G83pc73igseFGVk5KsLGgR2uSpT3LnT5kOYaNuV7YlFpkRI5lwm0WI71IxxDSbfHfrrnE7BVYWRocY3nGijoa6H5MEZ-2MuKULtP1R-bu-SYXUXfzA-GFd_MP4WcVkmzf_fQzeQkst-Iju3OFfAQAA__-j38ow">