Nikolas Klauser ffcb0a4559
[libc++] Update polymorphic_allocator to never contain a nullptr (#148423)
According to `[mem.poly.allocator.ctor]` the pointer contained in
`polymorphic_allocator` can never be null. The default constructor uses
`get_default_resource()`, which never returns null and the constructor
taking a pointer explicitly has a precondition that the pointer is
non-null.

This patch adds a warning and an assertion in case a user passes a null
pointer to `polymorphic_allocator` as well as marking `resource()` to
never return null.

This also fixes some tests which contained UB.

Fixes #148420
2025-07-16 10:03:57 +02:00
..