| 1 |
// PR c++/110057 |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* Virtual calls should be devirtualized because we know dynamic type of object in array at compile time */ |
| 4 |
/* { dg-options "-O3 -fdump-tree-optimized -fno-inline" } */ |
| 5 |
|
| 6 |
class A |
| 7 |
{ |
| 8 |
public: |
| 9 |
virtual ~A() |
| 10 |
{ |
| 11 |
} |
| 12 |
}; |
| 13 |
|
| 14 |
class B : public A |
| 15 |
{ |
| 16 |
public: |
| 17 |
virtual ~B() |
| 18 |
{ |
| 19 |
} |
| 20 |
}; |
| 21 |
|
| 22 |
int main() |
| 23 |
{ |
| 24 |
B* ptr = new B[10]; |
| 25 |
delete[] ptr; |
| 26 |
return 0; |
| 27 |
} |
| 28 |
|
| 29 |
/* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */ |