diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 529219ef239c..215bc5a2919f 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -214,7 +214,7 @@ public: ItTy getCurrent() { return this->I; } - FuncReturnTy operator*() { return F(*this->I); } + FuncReturnTy operator*() const { return F(*this->I); } private: FuncTy F; diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h index e71359e0dacb..51b6edf8ddda 100644 --- a/mlir/include/mlir/IR/Attributes.h +++ b/mlir/include/mlir/IR/Attributes.h @@ -228,7 +228,7 @@ private: explicit attr_value_iterator(ArrayAttr::iterator it) : llvm::mapped_iterator( it, [](Attribute attr) { return attr.cast(); }) {} - AttrTy operator*() { return (*this->I).template cast(); } + AttrTy operator*() const { return (*this->I).template cast(); } }; public: