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