From 77a3b64f0d7d9e95b921a45c0a8c1650d5910315 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 1 Feb 2018 09:37:47 -0500 Subject: [PATCH] test/log: fix for crash with libc++ the original issue reproduced with operator<<(const char*) in libstdc++, but this actually crashes with libc++. test the std::basic_streambuf* overload instead, which is called out explicitly in http://en.cppreference.com/w/cpp/io/ios_base/iostate: > The badbit is set by the following standard library functions: > * basic_ostream::operator<<(basic_streambuf*) when a null pointer is passed as the argument. Signed-off-by: Casey Bodley --- src/log/test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/log/test.cc b/src/log/test.cc index 73f037191ba..1f869b110f3 100644 --- a/src/log/test.cc +++ b/src/log/test.cc @@ -59,7 +59,7 @@ TEST(Log, ReuseBad) { auto e = log.create_entry(l, 1); auto& out = e->get_ostream(); - out << (const char*)nullptr; + out << (std::streambuf*)nullptr; EXPECT_TRUE(out.bad()); // writing nullptr to a stream sets its badbit log.submit_entry(e); } -- 2.39.5