diff options
-rw-r--r-- | mlir/include/mlir/IR/Dialect.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mlir/include/mlir/IR/Dialect.h b/mlir/include/mlir/IR/Dialect.h index 45f29f3..50f6f6d 100644 --- a/mlir/include/mlir/IR/Dialect.h +++ b/mlir/include/mlir/IR/Dialect.h @@ -281,7 +281,11 @@ protected: /// Register a set of type classes with this dialect. template <typename... Args> void addTypes() { - (addType<Args>(), ...); + // This initializer_list argument pack expansion is essentially equal to + // using a fold expression with a comma operator. Clang however, refuses + // to compile a fold expression with a depth of more than 256 by default. + // There seem to be no such limitations for initializer_list. + (void)std::initializer_list<int>{0, (addType<Args>(), 0)...}; } /// Register a type instance with this dialect. @@ -292,7 +296,11 @@ protected: /// Register a set of attribute classes with this dialect. template <typename... Args> void addAttributes() { - (addAttribute<Args>(), ...); + // This initializer_list argument pack expansion is essentially equal to + // using a fold expression with a comma operator. Clang however, refuses + // to compile a fold expression with a depth of more than 256 by default. + // There seem to be no such limitations for initializer_list. + (void)std::initializer_list<int>{0, (addAttribute<Args>(), 0)...}; } /// Register an attribute instance with this dialect. |