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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [init/] [ref9.C] - Blame information for rev 301

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-do run }
2
 
3
struct ex;
4
struct basic {
5
  int refcount;
6
  ex eval() const;
7
  basic() : refcount(0) {}
8
};
9
 
10
struct ex {
11
  basic *bp;
12
  ex() : bp(0) { }
13
  ex(const basic &);
14
  virtual ~ex();
15
  void construct_from_basic(const basic &);
16
};
17
 
18
ex basic::eval() const {
19
  throw 1;
20
}
21
 
22
inline ex::ex(const basic &b) { construct_from_basic (b); }
23
inline ex::~ex() { if (--bp->refcount == 0) delete bp; }
24
void ex::construct_from_basic(const basic &b) {
25
  const ex & tmpex = b.eval();
26
  bp = tmpex.bp;
27
  bp->refcount++;
28
}
29
 
30
ex pow() { return basic(); }
31
 
32
int main()
33
{
34
  try { pow (); } catch (int) {}
35
  return 0;
36
}

powered by: WebSVN 2.1.0

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