Add test that reproduces issue

This commit is contained in:
Treb Connell 2015-09-28 18:34:04 -07:00
parent b29566628e
commit 83333419de

View File

@ -178,13 +178,19 @@ SUITE(MaybeNullTests)
maybe_null<MyBase*> q = p; maybe_null<MyBase*> q = p;
CHECK(q == p); CHECK(q == p);
maybe_null_dbg<MyDerived*> pdbg = &derived;
CHECK(pdbg.present());
maybe_null_dbg<MyBase*> qdbg = pdbg;
CHECK(qdbg == pdbg);
#ifdef CONFIRM_COMPILATION_ERRORS #ifdef CONFIRM_COMPILATION_ERRORS
maybe_null<Unrelated*> r = p; maybe_null<Unrelated*> r = p;
maybe_null<Unrelated*> s = reinterpret_cast<Unrelated*>(p); maybe_null<Unrelated*> s = reinterpret_cast<Unrelated*>(p);
#endif #endif
maybe_null_dbg<Unrelated*> t = reinterpret_cast<Unrelated*>(p.get()); maybe_null_dbg<Unrelated*> t = reinterpret_cast<Unrelated*>(p.get());
CHECK_THROW((void)(void*)t.get(), fail_fast); CHECK_THROW((void)(void*)t.get(), fail_fast);
maybe_null_dbg<Unrelated*> u = reinterpret_cast<Unrelated*>(p.get()); maybe_null_dbg<Unrelated*> u = reinterpret_cast<Unrelated*>(p.get());
CHECK(u.present()); CHECK(u.present());
CHECK((void*)p.get() == (void*)u.get()); CHECK((void*)p.get() == (void*)u.get());