mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-02 14:15:46 +00:00
tests: add shared_ptr tests for const support
Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
@@ -50,3 +50,17 @@ BOOST_AUTO_TEST_CASE(explot_dynamic_cast_use_after_free_problem) {
|
||||
}
|
||||
BOOST_ASSERT(!A::destroyed);
|
||||
}
|
||||
|
||||
class C : public enable_shared_from_this<C> {
|
||||
public:
|
||||
shared_ptr<C> dup() { return shared_from_this(); }
|
||||
shared_ptr<const C> get() const { return shared_from_this(); }
|
||||
};
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_const_ptr) {
|
||||
shared_ptr<C> a = make_shared<C>();
|
||||
shared_ptr<const C> ca = a;
|
||||
BOOST_REQUIRE(ca == a);
|
||||
shared_ptr<const C> cca = ca->get();
|
||||
BOOST_REQUIRE(cca == ca);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user