[all-commits] [llvm/llvm-project] e6d738: [mlir][python] Mark operator== overloads as const

rk via All-commits all-commits at lists.llvm.org
Tue Mar 28 08:06:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e6d738e0c76b2fb63ee3f90740678b4e4a4c0b32
      https://github.com/llvm/llvm-project/commit/e6d738e0c76b2fb63ee3f90740678b4e4a4c0b32
  Author: Rahul Kayaith <rkayaith at gmail.com>
  Date:   2023-03-28 (Tue, 28 Mar 2023)

  Changed paths:
    M mlir/lib/Bindings/Python/IRAffine.cpp
    M mlir/lib/Bindings/Python/IRCore.cpp
    M mlir/lib/Bindings/Python/IRModule.h

  Log Message:
  -----------
  [mlir][python] Mark operator== overloads as const

This resolves some warnings when building with C++20, e.g.:
```
llvm-project/mlir/lib/Bindings/Python/IRAffine.cpp:545:60: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'mlir::python::PyAffineExpr' and 'mlir::python::PyAffineExpr') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
                        PyAffineExpr &other) { return self == other; })
                                                      ~~~~ ^  ~~~~~
llvm-project/mlir/lib/Bindings/Python/IRAffine.cpp:350:20: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
bool PyAffineExpr::operator==(const PyAffineExpr &other) {
                   ^
```

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D147018




More information about the All-commits mailing list