2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / badopt1.C
bloba4daa221ebf6170f41561bd683f20f3639eb3ce8
1 // { dg-do run  }
2 // { dg-options "-O2" }
3 // Based on a testcase by Bryan Weston <bryanw@bluemoon.sps.mot.com>
4 // egcs 1.1 fails to increment count
7 struct Base { Base() {} }; // removing the constructor fixes the problem
8 struct Derived : Base {}; // so does removing the base class
10 int main() {
11   int count = 0;
12   Derived* array[1]; // making this Base*[1] does not fix the problem
13   array[count++] = new Derived (); // but then new Base() does
14   if (count!=1)
15     return 1;