It's clang-tidy trying to stop you from writing code that accomplishes nothing:
(x++)++; // Did we just increment a temporary?
Such forms of overloading may be useful, but not usually for postfix ++
. You have two options:
Do as clang-tidy says, but then maybe lose the benfeits of move semantics.
lvalue ref-qualify the overload instead, to mimic the little ints.
X operator++(int) &; // Can't apply to rvalues anymore.
Option 2 is superior; prevents those silly mistakes, and retains move semantics if applicable.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…