31 lines · cpp
1// Test -fsanitize-memory-use-after-dtor2// RUN: %clang_cc1 -fsanitize=memory -O1 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s3// RUN: %clang_cc1 -fsanitize=memory -O2 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s4 5template <class T>6class Vector {7public:8 int size;9 ~Vector() {}10};11 12// Virtual function table for the derived class only contains13// its own destructors, with no aliasing to base class dtors.14struct Base {15 Vector<int> v;16 int x;17 Base() { x = 5; }18 virtual ~Base() {}19};20 21struct Derived : public Base {22 int z;23 Derived() { z = 10; }24 ~Derived() {}25};26 27Derived d;28 29// Definition of virtual function table30// CHECK: @_ZTV7Derived = {{.*}}@_ZN7DerivedD1Ev{{.*}}@_ZN7DerivedD0Ev31