From 052d8b8494dafed788042fd8e121aa403620ecf7 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..ed7f33d 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;