From 99854be9de9a0671b3f6565c5e8b252ef72a2971 Mon Sep 17 00:00:00 2001 From: Russell Liu Date: Tue, 22 Oct 2024 13:09:39 +0800 Subject: [PATCH] Comma expresion for MSVC fold expression bug Boolean fold expression seems like some bugs in MSVC, it's incorrectly removed. In other projects, we found similar problems. But gcc or clang not. On the other hand, fold expression with comma seems cleaner than lambda. Referenced-by: zigrazor/cxxgraph#415 --- include/llvm-dialects/Dialect/OpSet.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/llvm-dialects/Dialect/OpSet.h b/include/llvm-dialects/Dialect/OpSet.h index 3bb0b3e..d2c158d 100644 --- a/include/llvm-dialects/Dialect/OpSet.h +++ b/include/llvm-dialects/Dialect/OpSet.h @@ -92,10 +92,7 @@ class OpSet final { template static const OpSet &get() { static const auto set = ([]() { OpSet set; - (void)(... && ([&set]() { - set.tryInsertOp(OpDescription::get()); - return true; - })()); + (set.tryInsertOp(OpDescription::get()), ...); return set; })(); return set;