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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [copy3.C] - Blame information for rev 749

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

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// GROUPS passed copy-ctors
3
/*
4
 
5
If I compile it with cfront (AT&T C++ Translator 2.00.02 08/25/89) and run it
6
I get:
7
 
8
        A::A()
9
        A::A(const A&)
10
        B::Bar()
11
        A::~A()
12
        A::~A()
13
 
14
If I compile it with g++ (gcc version 2.2.2) and run it I get:
15
 
16
        A::A()
17
        B::Bar()
18
        A::~A()
19
        A::~A()
20
 
21
*/
22
extern "C" int printf (const char *, ...);
23
extern "C" void exit (int);
24
 
25
int count = 0;
26
 
27
void
28
die (int x)
29
{
30
  if (x != ++count)
31
    {
32
      printf ("FAIL\n");
33
      exit (1);
34
    }
35
}
36
 
37
 
38
class A {
39
public:
40
  A() { die (1); }
41
  A(const A&) { die (2); }
42
  ~A() { count++; if (count != 4 && count != 5) die (-1); }
43
};
44
 
45
class B : public A {
46
public:
47
  void Bar() { die (3); }
48
};
49
 
50
void Foo(B b) { b.Bar(); }
51
 
52
int
53
main()
54
{
55
  B b;
56
  Foo(b);
57
 
58
  printf ("PASS\n");
59
}

powered by: WebSVN 2.1.0

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