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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [eh/] [uncaught1.C] - Blame information for rev 751

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

Line No. Rev Author Line
1 693 jeremybenn
// PR libstdc++/10606
2
// { dg-do run }
3
// { dg-options "-fuse-cxa-get-exception-ptr" { target powerpc*-*-darwin* } }
4
 
5
#include 
6
#include 
7
 
8
 
9
struct Check {
10
  int obj1, obj2;
11
  bool state;
12
};
13
 
14
static Check const data[] = {
15
  { 0, 0, false },      // construct [0]
16
  { 1, 0, true  },      // [1] = [0]
17
  { 0, 0, true  },      // destruct [0]
18
  { 2, 1, true  },      // [2] = [1]
19
  { 2, 2, true  },      // destruct [2]
20
  { 3, 1, true  },      // [3] = [1]
21
  { 3, 3, false },      // destruct [3]
22
  { 1, 1, false },      // destruct [1]
23
  { 9, 9, false }       // end-of-data
24
};
25
 
26
static int pos = 0;
27
 
28
static void test(int obj1, int obj2, bool state)
29
{
30
  if (obj1 != data[pos].obj1) abort ();
31
  if (obj2 != data[pos].obj2) abort ();
32
  if (state != data[pos].state) abort ();
33
  pos++;
34
}
35
 
36
 
37
struct S {
38
  int id;
39
  S ();
40
  S (const S &);
41
  ~S ();
42
};
43
 
44
static int next_id = 0;
45
 
46
S::S()
47
  : id (next_id++)
48
{
49
  test (id, id, std::uncaught_exception ());
50
}
51
 
52
S::S(const S &x)
53
  : id (next_id++)
54
{
55
  test (id, x.id, std::uncaught_exception ());
56
}
57
 
58
S::~S()
59
{
60
  test (id, id, std::uncaught_exception ());
61
}
62
 
63
extern void foo (S *);
64
 
65
int main()
66
{
67
  try
68
    {
69
      try
70
        {
71
          S s0;
72
          throw s0;     // s1 is the exception object
73
        }
74
      catch (S s2)
75
        {
76
          throw;
77
        }
78
    }
79
  catch (S s3)
80
    {
81
    }
82
 
83
  return 0;
84
}

powered by: WebSVN 2.1.0

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