http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55970
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-02-04 11:15:15 UTC --- You could use a wrapper function to guarantee order of evaluation. The one here seems a bit too complex: http://stackoverflow.com/questions/14058592/how-to-guarantee-order-of-argument-evaluation-when-calling-a-function-object Or you could build a gcc plugin that adds a wrapper around each function call in order to evaluate arguments left-to-right. GCC should definitely warn about this, isn't there a bug open? Another testcase is: void f(int, int); void test() { int i = 0; int v[1] = {0}; f(v[i], i++); // warn } This one doesn't involve function calls in the arguments.