OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.mike/] [p9706.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
2
// { dg-options "-fexceptions" }
3
// prms-id: 9706
4
 
5
#include 
6
 
7
int count, acount;
8
 
9
void *operator new(size_t sz) { ++count; return malloc (sz); }
10
void operator delete(void *p) throw() { --count; free (p); }
11
 
12
class A {
13
public:
14
  A() { ++acount; }
15
  A(const A&) { ++acount; }
16
  ~A() { --acount; }
17
};
18
 
19
int main() {
20
  int i;
21
 
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;
25
 
26
  for( i = 0; i < 10; i++ ) {
27
    try {
28
      throw A();
29
    }
30
    catch (A& a) {
31
    }
32
  }
33
  if (acount)
34
    return 1;
35
  if (count)
36
    return 2;
37
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.