https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106827
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think C++ doesn't explicitly say that the argument has to be a reference: https://eel.is/c++draft/over.oper#over.inc but obviously if it isn't and it isn't a non-static method operator++, then it can only compute the return value and can't actually modify in place. For ++i just operator++(i) is called and for i++ operator++(i, 0). So, with your overloads you'd actually need to do i = ++i The other overload is just unusable because it does the wrong thing completely.