diff --git a/include/cudaq/Optimizer/Dialect/Quake/QuakeTypes.td b/include/cudaq/Optimizer/Dialect/Quake/QuakeTypes.td index 7dd31469fd..0aac6fa46c 100644 --- a/include/cudaq/Optimizer/Dialect/Quake/QuakeTypes.td +++ b/include/cudaq/Optimizer/Dialect/Quake/QuakeTypes.td @@ -153,9 +153,12 @@ def VeqType : QuakeType<"Veq", "veq"> { let hasCustomAssemblyFormat = 1; let extraClassDeclaration = [{ - bool hasSpecifiedSize() const { return getSize(); } + static constexpr std::size_t kDynamicSize = + std::numeric_limits::max(); + + bool hasSpecifiedSize() const { return getSize() != kDynamicSize; } static VeqType getUnsized(mlir::MLIRContext *ctx) { - return VeqType::get(ctx, 0); + return VeqType::get(ctx, kDynamicSize); } }]; } diff --git a/lib/Optimizer/Dialect/Quake/QuakeTypes.cpp b/lib/Optimizer/Dialect/Quake/QuakeTypes.cpp index b536a59710..d124e32c3c 100644 --- a/lib/Optimizer/Dialect/Quake/QuakeTypes.cpp +++ b/lib/Optimizer/Dialect/Quake/QuakeTypes.cpp @@ -39,9 +39,9 @@ void quake::VeqType::print(AsmPrinter &os) const { Type quake::VeqType::parse(AsmParser &parser) { if (parser.parseLess()) return {}; - std::size_t size = 0; + std::size_t size = kDynamicSize; if (succeeded(parser.parseOptionalQuestion())) - size = 0; + size = kDynamicSize; else if (parser.parseInteger(size)) return {}; if (parser.parseGreater())