Index: test/msan/dtor-trivial.cpp =================================================================== --- test/msan/dtor-trivial.cpp +++ test/msan/dtor-trivial.cpp @@ -4,7 +4,9 @@ // RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1 -// TODO Success pending on resolution of 596 +// TODO Success pending on resolution of +// https://github.com/google/sanitizers/issues/596 + // XFAIL: * #include Index: test/msan/dtor-vtable.cc =================================================================== --- /dev/null +++ test/msan/dtor-vtable.cc @@ -0,0 +1,26 @@ +// RUN: %clangxx_msan %s -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t + +// RUN: %clangxx_msan %s -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t + +// RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t + +// Expected to quit due to invalid access when invoking +// function using vtable. +// XFAIL: * + +#include + +class A { +public: + int x; + ~A() {} + virtual void A_Foo() {} +}; + +int main() { + A *a = new A(); + a->~A(); + // Shouldn't be allowed to invoke function via vtable. + a->A_Foo(); + return 0; +}