summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/buildtool/multithreading/task_system.test.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/buildtool/multithreading/task_system.test.cpp b/test/buildtool/multithreading/task_system.test.cpp
index 8488417c..21e1ca6e 100644
--- a/test/buildtool/multithreading/task_system.test.cpp
+++ b/test/buildtool/multithreading/task_system.test.cpp
@@ -69,8 +69,10 @@ TEST_CASE("Side effects of tasks are reflected out of ts", "[task_system]") {
SECTION("Lambda capturing `this` inside struct") {
std::string ext_name{};
struct Wrapper {
- TaskSystem ts{};
std::string name{};
+ // ts must be second, otherwise name will get destroyed before the
+ // task system is finished.
+ TaskSystem ts{};
explicit Wrapper(std::string n) : name{std::move(n)} {}