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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [call1.C] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Bug c++/16115
2
// { dg-options "-O2" }
3
 
4
extern "C" void abort();
5
 
6
int count = 0;
7
 
8
struct T {
9
    T() { count++; }
10
    T(const T&) { count++; }
11
    ~T() { if (count==0) abort(); --count; }
12
};
13
 
14
struct auto_ptr {
15
    T* p;
16
 
17
    auto_ptr(T* __p) : p(__p) { }
18
    ~auto_ptr() { delete p; }
19
 
20
    T* release() {
21
      T* t = p;
22
      p = 0;
23
      return t;
24
    }
25
};
26
 
27
void destroy (auto_ptr a) {
28
  delete a.release();
29
}
30
 
31
 
32
int main ()
33
{
34
  destroy (new T);
35
}

powered by: WebSVN 2.1.0

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