From 38449a598dbfa3e079353d1f218938dbcbbfce38 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Thu, 24 Jan 2019 18:43:50 +0800 Subject: [PATCH] fix test error --- test/test_circ.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_circ.cpp b/test/test_circ.cpp index dee2808..0b05b18 100644 --- a/test/test_circ.cpp +++ b/test/test_circ.cpp @@ -24,7 +24,9 @@ template using pc_t = ipc::prod_cons_impl>; template -using ea_t = ipc::circ::elem_array; +struct ea_t : public ipc::circ::elem_array { + ea_t() { std::memset(this, 0, sizeof(ipc::circ::elem_array)); } +}; using cq_t = ea_t< sizeof(msg_t), @@ -176,7 +178,7 @@ struct test_cq> { ca_t* ca_; test_cq(void*) : ca_(reinterpret_cast(cq__)) { - std::memset(ca_, 0, sizeof(ca_t)); + ::new (ca_) ca_t; } cn_t* connect() { @@ -243,7 +245,6 @@ constexpr int LoopCount = 1000000; void Unit::initTestCase() { TestSuite::initTestCase(); cq__ = new cq_t; - std::memset(cq__, 0, sizeof(cq_t)); } void Unit::cleanupTestCase() {