https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115160
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- There is no sequence point analyzer in any compiler I'm aware of and I think it would be extremely hard to implement that. GCC has -Wsequence-point warning, which can handle lots of cases, but with the C++ abstractions the front-end can't really know what the different function calls will do and whether they have some undesirable side-effects or not. With the pointers, the compiler sees the post-increment operations, with overloaded operators it doesn't, it sees calls to some operator and it doesn't know what the operator will do. Those functions could be pure and not change anything on the shared object, or they can change it.