blob: 456d44f84bd6aa427cc01a5474ba660db502d3a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* No devirtualization happens here, but A::foo should not end up as reachable
because the constructor of A is unreachable and therefore the virtual
method table referring to A::foo is optimized out. */
/* { dg-do run } */
/* { dg-options "-O2 -fdump-tree-ssa" } */
class B {
public:
virtual int foo(void)
{
return 0;
}
};
namespace {
class A : public B {
public:
virtual int foo(void)
{
return 1;
}
};
}
class B a, *b=&a;
main()
{
if (0)
{
class A a;
a.foo();
}
return b->foo();
}
/* { dg-final { scan-tree-dump-not "A::foo" "ssa"} } */
/* { dg-final { cleanup-tree-dump "ssa" } } */
|