[Mlir-commits] [mlir] [mlir] Fix build after ec50f5828f25 (PR #101021)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jul 29 07:38:23 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Ryan Holt (ryan-holt-1)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/101021.diff
1 Files Affected:
- (modified) mlir/unittests/Support/CyclicReplacerCacheTest.cpp (+5-4)
``````````diff
diff --git a/mlir/unittests/Support/CyclicReplacerCacheTest.cpp b/mlir/unittests/Support/CyclicReplacerCacheTest.cpp
index ca2eb6ce4171f..64a8ab72b69b7 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);
}
//===----------------------------------------------------------------------===//
``````````
</details>
https://github.com/llvm/llvm-project/pull/101021
More information about the Mlir-commits
mailing list