------- Comment #3 from pinskia at gcc dot gnu dot org 2006-09-04 19:09 -------
void AddElement (const T& val) { _array[Newidx()] = val; } I think this code contains unspecified behavior. There are no sequence points between the this->_array and the function call Newidx() so we load this->_array before the function call which is valid according to the C++ standard. Can you try changing AddElement to: void AddElement (const T& val) { int newidx = Newidx(); _array[newidx] = val; } And try again? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28951