[libc++] Define ostream nullptr inserter for >= C++17 only
authorJoe Loser <joeloser93@gmail.com>
Fri, 3 Jun 2022 23:05:23 +0000 (17:05 -0600)
committerJoe Loser <joeloser93@gmail.com>
Wed, 20 Jul 2022 00:16:45 +0000 (18:16 -0600)
commit50cfb76e029bbfda21622d4f00c9fe8a2a7099a6
tree352247f33981868fd90105656e67143c0c131828
parent3f73c5793515867935d59ff8c511c61ace848e79
[libc++] Define ostream nullptr inserter for >= C++17 only

The `ostream` `nullptr` inserter implemented in 3c125fe is missing a C++ version
guard. Normally, `libc++` takes the stance of backporting LWG issues to older
standards modes as was done in 3c125fe. However, backporting to older standards
modes breaks existing code in popular libraries such as `Boost.Test` and
`Google Test` who define their own overload for `nullptr_t`.

Instead, only apply this `operator<<` overload in C++17 or later.

Fixes https://github.com/llvm/llvm-project/issues/55861.

Differential Revision: https://reviews.llvm.org/D127033
libcxx/include/ostream
libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp