Fix new ASAN failures

llvm-svn: 278736
This commit is contained in:
Eric Fiselier 2016-08-15 20:50:01 +00:00
parent 60dcc1344a
commit 5f6100260b
2 changed files with 3 additions and 2 deletions

View File

@ -61,8 +61,8 @@ int main()
C c(std::begin(t), std::end(t));
c.reserve(2*c.size());
assert(is_contiguous_container_asan_correct(c));
assert(!__sanitizer_verify_contiguous_container ( c.data(), c.data() + 1, c.data() + c.capacity()));
T foo = c[c.size()]; // should trigger ASAN
assert(!__sanitizer_verify_contiguous_container( c.data(), c.data() + 1, c.data() + c.capacity()));
volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to prevent being optimized away.
assert(false); // if we got here, ASAN didn't trigger
}
}

View File

@ -25,4 +25,5 @@ struct B : A {};
int main() {
A* ptr = new B;
(void)dynamic_cast<B*>(ptr);
delete ptr;
}