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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [ext/] [complit12.C] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// PR c++/40948
2
// { dg-do run }
3
// { dg-options "" }
4
 
5
int c;
6
struct M
7
{
8
  M () { ++c; }
9
  M (const M&) { ++c; }
10
  ~M () { --c; }
11
};
12
 
13
struct S
14
{
15
  S ();
16
  M m[1];
17
};
18
 
19
S::S () : m ((M[1]) { M () })
20
{
21
}
22
 
23
struct T
24
{
25
  T ();
26
  M m[4];
27
};
28
 
29
T::T () : m ((M[4]) { M (), M (), M (), M () })
30
{
31
}
32
 
33
typedef M MA[1];
34
MA &bar (MA, MA& r) { return r; }
35
 
36
M f(M m) { return m; }
37
 
38
int main ()
39
{
40
  {
41
    M m[1] = (M[1]) { M () };
42
    if (c != 1)
43
      return 1;
44
    M n = (M) { M () };
45
    if (c != 2)
46
      return 2;
47
    M o[4] = (M[4]) { M (), M (), M (), M () };
48
    if (c != 6)
49
      return 3;
50
    S s;
51
    if (c != 7)
52
      return 4;
53
    T t;
54
    if (c != 11)
55
      return 5;
56
    MA ma = bar ((M[2]) { M(), M() }, m);
57
    if (c != 12)
58
      return 7;
59
    M mm[2] = ((M[2]) { f(M()), f(M()) });
60
    if (c != 14)
61
      return 8;
62
  }
63
  if (c != 0)
64
    return 6;
65
}

powered by: WebSVN 2.1.0

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