From: Casey Bodley Date: Thu, 1 Feb 2018 14:37:47 +0000 (-0500) Subject: test/log: fix for crash with libc++ X-Git-Tag: v13.0.2~344^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F20233%2Fhead;p=ceph.git 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 --- diff --git a/src/log/test.cc b/src/log/test.cc index 73f037191bab..1f869b110f36 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); }