[Mlir-commits] [mlir] 80ff391 - [mlir] Fix build after ec50f5828f25 (#101021)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Aug 11 18:46:00 PDT 2024
Author: Ryan Holt
Date: 2024-08-11T21:45:56-04:00
New Revision: 80ff391190226b57fc3b192f7c941778c4ed2126
URL: https://github.com/llvm/llvm-project/commit/80ff391190226b57fc3b192f7c941778c4ed2126
DIFF: https://github.com/llvm/llvm-project/commit/80ff391190226b57fc3b192f7c941778c4ed2126.diff
LOG: [mlir] Fix build after ec50f5828f25 (#101021)
This commit fixes what appears to be invalid C++ -- a lambda capturing a
variable before it is declared. The code compiles with GCC and Clang but
not MSVC.
Added:
Modified:
mlir/unittests/Support/CyclicReplacerCacheTest.cpp
Removed:
################################################################################
diff --git a/mlir/unittests/Support/CyclicReplacerCacheTest.cpp b/mlir/unittests/Support/CyclicReplacerCacheTest.cpp
index ca2eb6ce4171f7..64a8ab72b69b7d 100644
--- a/mlir/unittests/Support/CyclicReplacerCacheTest.cpp
+++ b/mlir/unittests/Support/CyclicReplacerCacheTest.cpp
@@ -26,14 +26,15 @@ TEST(CachedCyclicReplacerTest, testNoRecursion) {
TEST(CachedCyclicReplacerTest, testInPlaceRecursionPruneAnywhere) {
// Replacer cycles through ints 0 -> 1 -> 2 -> 0 -> ...
- CachedCyclicReplacer<int, int> replacer(
- /*replacer=*/[&](int n) { return replacer((n + 1) % 3); },
+ std::optional<CachedCyclicReplacer<int, int>> replacer;
+ replacer.emplace(
+ /*replacer=*/[&](int n) { return (*replacer)((n + 1) % 3); },
/*cycleBreaker=*/[&](int n) { return -1; });
// Starting at 0.
- EXPECT_EQ(replacer(0), -1);
+ EXPECT_EQ((*replacer)(0), -1);
// Starting at 2.
- EXPECT_EQ(replacer(2), -1);
+ EXPECT_EQ((*replacer)(2), -1);
}
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list