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
[31/77] Use scalar_int_mode for move2add
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.mike
/
thunk2.C
blob
fa864b4aaaa48c8a2f0cb44eac60e8814e0c83a3
1
// { dg-do run }
2
#include <typeinfo>
3
4
int state;
5
int fail;
6
7
class A {
8
public:
9
A() {
10
if (++state != 1)
11
fail = 1;
12
}
13
virtual int foo() {
14
if (++state != 2)
15
fail = 1;
16
return 0;
17
}
18
virtual ~A() {
19
if (++state != 3)
20
fail = 1;
21
}
22
};
23
24
A* bar() {
25
return new A;
26
}
27
28
int main() {
29
A *aptr = bar();
30
aptr->foo();
31
if (dynamic_cast <void*> (aptr) != aptr)
32
fail = 1;
33
if (typeid (*aptr) != typeid (A))
34
fail = 1;
35
delete aptr;
36
if (++state != 4)
37
fail = 1;
38
return fail;
39
}