llvm-project
bb6868ab - [libc++] Fix behavior for `get_temporary_buffer` with non-positive size (#206871)

Commit
26 days ago
[libc++] Fix behavior for `get_temporary_buffer` with non-positive size (#206871) Per C++17 [depr.temporary.buffer]/4, `get_temporary_buffer` is required to return `{nullptr, 0}` when the size argument is zero or negative. libc++ used to correctly handle this, but the refactoring in 94e7c0b051c79fd56205f115771980f2e7812306 got this wrong. GCC generally warns on negative size due to `-Walloc-size-larger-than=`, which is false positive due to incomplete control flow analysis. The warning is coupled with optimizations, and this patch make tests suppress it instead.
Parents
Loading