Revert "Roll NDK to r11c and extract it into its own repository."
[android_tools.git] / ndk / tests / device / test-stlport_shared-exception / jni / p9706.cpp
blob0ed15e4c85c182bf33745ddd5f8244db9de8404e
1 // { dg-do run { xfail sparc64-*-elf arm-*-pe } }
2 // { dg-options "-fexceptions" }
3 // prms-id: 9706
5 #include <stdlib.h>
7 int count, acount;
9 void *operator new(size_t sz) { ++count; return malloc (sz); }
10 void operator delete(void *p) throw() { --count; free (p); }
12 class A {
13 public:
14 A() { ++acount; }
15 A(const A&) { ++acount; }
16 ~A() { --acount; }
19 int main() {
20 int i;
22 // The standard library may have called new and/or delete during
23 // startup, so we have to reset the counter here.
24 count = 0;
26 for( i = 0; i < 10; i++ ) {
27 try {
28 throw A();
30 catch (A& a) {
33 if (acount)
34 return 1;
35 if (count)
36 return 2;