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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/15172
2
// { dg-do run }
3
 
4
extern "C" int printf (const char *, ...);
5
extern "C" void abort ();
6
 
7
struct A {
8
  static A* p;
9
 
10
  A() { p = this; }
11
  A(const A&);
12
  ~A() { if (this != p) abort (); }
13
  void print () { }
14
};
15
 
16
A* A::p;
17
 
18
struct B {
19
  A a;
20
};
21
 
22
B b = { A () };
23
 
24
struct A2 {
25
  static A2* p;
26
 
27
  A2() { p = this; }
28
  A2(const A2&);
29
  ~A2() { if (this != p) abort (); }
30
  void print () { }
31
};
32
 
33
A2* A2::p;
34
 
35
struct B2 {
36
  A2 a2;
37
};
38
 
39
int main () {
40
  b.a.print ();
41
  {
42
    B2 b2 = { A2() };
43
    b2.a2.print ();
44
  }
45
}
46
 

powered by: WebSVN 2.1.0

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