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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [copy2.C] - Blame information for rev 779

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

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed copy-ctors
3
/*
4
The old g++ output is
5
 
6
Item()
7
Compound()
8
Pre foo
9
foo
10
~Compound()
11
~Item()
12
Post foo
13
~Compound()
14
~Item()
15
 
16
The output should be something like (produced from ATT 2.1)
17
 
18
Item()
19
Compound()
20
Pre foo
21
Item(const Item& i)    <------ missing above
22
foo
23
~Compound()
24
~Item()
25
Post foo
26
~Compound()
27
~Item()
28
 
29
*/
30
 
31
extern "C" int printf (const char *, ...);
32
extern "C" void exit (int);
33
 
34
int count = 0;
35
 
36
void
37
die (int x)
38
{
39
  if (x != ++count)
40
    {
41
      printf ("FAIL\n");
42
      exit (1);
43
    }
44
}
45
 
46
 
47
class Item {
48
 public:
49
  Item() { die (1); }
50
  Item(const Item& i) { die (4); }
51
  ~Item() { count++; if (count != 7 && count != 10) die (-1); }
52
};
53
 
54
 
55
class Compound {
56
  Item i;
57
 public:
58
  Compound() { die (2); }
59
  ~Compound() { count++; if (count != 6 && count != 9) die (-1); }
60
};
61
 
62
 
63
void foo(Compound a)
64
{
65
  die (5);
66
}
67
 
68
int
69
main()
70
{
71
  Compound a;
72
 
73
  die (3);
74
  foo(a);
75
 
76
  die (8);
77
 
78
  printf ("PASS\n");
79
}
80
 

powered by: WebSVN 2.1.0

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