diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/tree-ssa/devirt-array-destructor-2.C')
-rw-r--r-- | gcc/testsuite/g++.dg/tree-ssa/devirt-array-destructor-2.C | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/tree-ssa/devirt-array-destructor-2.C b/gcc/testsuite/g++.dg/tree-ssa/devirt-array-destructor-2.C new file mode 100644 index 0000000..6b44dc1 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/devirt-array-destructor-2.C @@ -0,0 +1,29 @@ +// PR c++/110057 +/* { dg-do-compile } */ +/* Virtual calls should be devirtualized because we know dynamic type of object in array at compile time */ +/* { dg-options "-O3 -fdump-tree-optimized -fno-inline" } */ + +class A +{ +public: + virtual ~A() + { + } +}; + +class B : public A +{ +public: + virtual ~B() + { + } +}; + +int main() +{ + B* ptr = new B[10]; + delete[] ptr; + return 0; +} + +/* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */ |