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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [tc1/] [dr193.C] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run }
2
// Origin: Giovanni Bajo 
3
// DR193: Order of destruction of local automatics of destructor
4
 
5
extern "C" void abort(void);
6
 
7
namespace N1 {
8
  bool a_done = false;
9
  struct A
10
  {
11
    ~A()
12
    {
13
      a_done = true;
14
    }
15
  };
16
 
17
  struct B
18
  {
19
    ~B()
20
    {
21
      if (!a_done)
22
        abort();
23
    }
24
  };
25
 
26
  struct C {
27
    B x;
28
    ~C() {
29
      A y;
30
    };
31
  };
32
}
33
 
34
 
35
namespace N2 {
36
  bool a_done = false;
37
 
38
  template 
39
  struct A
40
  {
41
    ~A()
42
    {
43
      a_done = true;
44
    }
45
  };
46
 
47
  template 
48
  struct B
49
  {
50
    ~B()
51
    {
52
      if (!a_done)
53
        abort();
54
    }
55
  };
56
 
57
  template 
58
  struct C {
59
    B x;
60
    ~C() {
61
      A y;
62
    };
63
  };
64
}
65
 
66
 
67
int main(void)
68
{
69
  N1::C c1;
70
  N2::C c2;
71
  return 0;
72
}

powered by: WebSVN 2.1.0

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