gcc/testsuite/g++.dg/ipa/devirt-13.C
raw| 1 | /* { dg-do run } */ |
| 2 | /* Call to foo should be devirtualized because there are no derived types of A. */ |
| 3 | /* { dg-options "-O2 -fdump-tree-ssa" } */ |
| 4 | namespace { |
| 5 | class A { |
| 6 | public: |
| 7 | virtual int foo(void) |
| 8 | { |
| 9 | return 0; |
| 10 | } |
| 11 | }; |
| 12 | } |
| 13 | class A a, *b=&a; |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | return b->foo(); |
| 18 | } |
| 19 | |
| 20 | /* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "ssa"} } */ |