]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/log: fix for crash with libc++
authorCasey Bodley <cbodley@redhat.com>
Thu, 1 Feb 2018 14:37:47 +0000 (09:37 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 1 Feb 2018 14:37:48 +0000 (09:37 -0500)
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 <cbodley@redhat.com>
src/log/test.cc

index 73f037191bab610a9cda91aca66a0fae154bddb0..1f869b110f36b4275ab64cea818114463a23fc54 100644 (file)
@@ -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);
   }