OSDN Git Service

* g++.old-deja/g++.other/eh4.C: Fix typo.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / badopt1.C
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
6 struct Base { Base() {} }; // removing the constructor fixes the problem
7 struct Derived : Base {}; // so does removing the base class
8
9 int 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 }