[Bug c++/61597] Unexpected behavior at runtime

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 25 13:08:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61597

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Marc:

struct Iter
{
  Iter& operator+=(int) { return *this; }

  int operator*() { return i; }

  int i;
};

Iter& func(Iter iter, int n) {
    return iter += n;
}

int main()
{
    Iter iter = Iter();
    Iter it = func(iter, 2);
    return *it;
}



More information about the Gcc-bugs mailing list