summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/__debug4
-rw-r--r--libcxx/test/containers/sequences/vector/db_iterators_1.pass.cpp53
2 files changed, 56 insertions, 1 deletions
diff --git a/libcxx/include/__debug b/libcxx/include/__debug
index c7bd5d0fac6..0d631bf0438 100644
--- a/libcxx/include/__debug
+++ b/libcxx/include/__debug
@@ -16,7 +16,9 @@
# include <cstdlib>
# include <cstdio>
# include <cstddef>
-# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
+# ifndef _LIBCPP_ASSERT
+# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
+# endif
#endif
diff --git a/libcxx/test/containers/sequences/vector/db_iterators_1.pass.cpp b/libcxx/test/containers/sequences/vector/db_iterators_1.pass.cpp
new file mode 100644
index 00000000000..6fff0ba80b5
--- /dev/null
+++ b/libcxx/test/containers/sequences/vector/db_iterators_1.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// iterator begin();
+// iterator end();
+// const_iterator begin() const;
+// const_iterator end() const;
+// const_iterator cbegin() const;
+// const_iterator cend() const;
+
+#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 c1;
+ C c2;
+ bool b = c1.begin() != c2.begin();
+ assert(false);
+}
+
+#else
+
+int main()
+{
+}
+
+#endif \ No newline at end of file
OpenPOWER on IntegriCloud