URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [init/] [call1.C] - Rev 154
Compare with Previous | Blame | View Log
// Bug c++/16115
// { dg-options "-O2" }
extern "C" void abort();
int count = 0;
struct T {
T() { count++; }
T(const T&) { count++; }
~T() { if (count==0) abort(); --count; }
};
struct auto_ptr {
T* p;
auto_ptr(T* __p) : p(__p) { }
~auto_ptr() { delete p; }
T* release() {
T* t = p;
p = 0;
return t;
}
};
void destroy (auto_ptr a) {
delete a.release();
}
int main ()
{
destroy (new T);
}