More vector::iterator debug mode tests. Run by adding to OPTIONS -D_LIBCPP_DEBUG2=1.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177897 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-03-25 20:03:19 +00:00
parent f5f4684e71
commit 0d01eb54e7
8 changed files with 346 additions and 7 deletions

View File

@@ -0,0 +1,49 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <vector>
// Index iterator out of bounds.
#if _LIBCPP_DEBUG2 >= 1
struct X {};
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::terminate())
#include <vector>
#include <cassert>
#include <iterator>
#include <exception>
#include <cstdlib>
void f1()
{
std::exit(0);
}
int main()
{
std::set_terminate(f1);
typedef int T;
typedef std::vector<T> C;
C c(1);
C::iterator i = c.begin();
assert(i[0] == 0);
assert(i[1] == 0);
assert(false);
}
#else
int main()
{
}
#endif