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
Update ChangeLogs and version numbers for 2.95.3 release
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.robertl
/
eb17.C
blob
f32dadba9a53468a503e704da85974656438ea4d
1
// excess errors test - XFAIL
2
// covariant return types in are currently not support for complex inheritance
3
#include <stdio.h>
4
5
class A {
6
public:
7
virtual void print();
8
virtual A * clone();
9
};
10
11
class B : virtual public A {
12
public:
13
void print();
14
B * clone();
15
};
16
17
void A::print()
18
{
19
printf("A\n");
20
}
21
22
void B::print()
23
{
24
printf("B\n");
25
}
26
27
28
A * A::clone()
29
{
30
return this;
31
}
32
33
B * B::clone()
34
{
35
return this;
36
}
37
38
39
int main()
40
{
41
A * a = new B;
42
B * b = dynamic_cast<B *>(a);
43
44
printf("%p\n",b); // (*2*)
45
b->print();
46
47
a = b;
48
printf("%p\n",a);
49
a->print();
50
51
a = a->clone();
52
printf("%p\n",a);
53
a->print(); // (*1*)
54
55
return 0;
56
}