From d7acb7e8b8e382cac5f48acfa5401345e5c24e40 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 25 Apr 2023 13:41:36 -0700 Subject: [PATCH] Fix capturing in latch_tests --- test/cfoa/latch_tests.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/cfoa/latch_tests.cpp b/test/cfoa/latch_tests.cpp index 8bad302a..0c7e9ece 100644 --- a/test/cfoa/latch_tests.cpp +++ b/test/cfoa/latch_tests.cpp @@ -114,7 +114,7 @@ namespace { void test_arrive_and_wait() { - constexpr std::ptrdiff_t n = 16; + std::ptrdiff_t const n = 16; boost::latch l(2 * n); @@ -122,7 +122,8 @@ namespace { std::vector threads; for (int i = 0; i < n; ++i) { - threads.emplace_back([&l, &xs, i] { + threads.emplace_back([&l, &xs, i, n] { + (void)n; for (int j = 0; j < n; ++j) { BOOST_TEST_EQ(xs[j], 0); }