[libcxx-commits] [PATCH] D109298: [libc++][NFC] Make tuple dtor test compile test
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 7 09:36:49 PDT 2021
ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.
Instead of moving this to a `.compile.pass.cpp`, I'd like to add an actual runtime test that the dtor does the right thing. Something like this:
struct TrackDtor {
bool* dtorCalled_;
constexpr explicit TrackDtor(bool* dtorCalled) : dtorCalled_(dtorCalled) { }
TEST_CONSTEXPR_CXX20 ~TrackDtor() { *dtorCalled_ = true; }
};
TEST_CONSTEXPR_CXX20 bool test() {
bool called = false;
{
std::tuple<TrackDtor> tuple(TrackDtor(&called));
assert(!called);
}
assert(called);
return true;
}
int main(int, char**) {
test();
#if TEST_STD_VER > 20
static_assert(test());
#endif
return 0;
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109298/new/
https://reviews.llvm.org/D109298
More information about the libcxx-commits
mailing list