This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Mark operator== overloads as const
ClosedPublic

Authored by rkayaith on Mar 27 2023, 7:22 PM.

Details

Summary

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) {
                   ^

Diff Detail

Event Timeline

rkayaith created this revision.Mar 27 2023, 7:22 PM
rkayaith published this revision for review.Mar 27 2023, 7:50 PM
rkayaith added a reviewer: mehdi_amini.
ftynse accepted this revision.Mar 28 2023, 1:44 AM
This revision is now accepted and ready to land.Mar 28 2023, 1:44 AM
This revision was automatically updated to reflect the committed changes.