1// Based on a testcase by Bryan Weston <bryanw@bluemoon.sps.mot.com> 2// egcs 1.1 fails to increment count 3 4// Special g++ Options: -O2 5 6struct Base { Base() {} }; // removing the constructor fixes the problem 7struct Derived : Base {}; // so does removing the base class 8 9int main() { 10 int count = 0; 11 Derived* array[1]; // making this Base*[1] does not fix the problem 12 array[count++] = new Derived (); // but then new Base() does 13 if (count!=1) 14 return 1; 15} 16