repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.mike
/
p2846.C
blob
bce20bb0048849919b9e0cb35d227c5b1aaa77e8
1
// { dg-do run }
2
// prms-id: 2846
3
4
extern "C" int printf(const char *, ...);
5
extern "C" void exit(int);
6
7
class A;
8
class B;
9
10
int c;
11
12
class A {
13
public:
14
15
A(void){}
16
A(const A&){}
17
A(const B&);
18
19
virtual ~A(void){}
20
21
virtual void print(void) const {
22
printf("A::print\n");
23
printf("FAIL\n");
24
exit(1);
25
}
26
B compute(void) const;
27
};
28
29
class B : private A {
30
friend class A;
31
public:
32
33
virtual ~B(void){}
34
35
void print(void) const {
36
++c;
37
printf("B::print\n");
38
}
39
40
private:
41
B(const A& x, int){}
42
};
43
44
A::A(const B& s) {
45
s.print();
46
}
47
48
B A::compute(void) const {
49
B sub(*this, 1);
50
return sub;
51
}
52
53
int main ()
54
{
55
A titi;
56
A toto = titi.compute();
57
if (c != 1)
58
{
59
printf ("FAIL\n");
60
return 1;
61
}
62
else
63
{
64
printf("PASS\n");
65
return 0;
66
}
67
}