aboutsummaryrefslogtreecommitdiff
path: root/test/libcxx/containers/sequences/list/db_back.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/libcxx/containers/sequences/list/db_back.pass.cpp')
-rw-r--r--test/libcxx/containers/sequences/list/db_back.pass.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/libcxx/containers/sequences/list/db_back.pass.cpp b/test/libcxx/containers/sequences/list/db_back.pass.cpp
new file mode 100644
index 000000000000..96dfd2d8d2ec
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/db_back.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call back() on empty container.
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+int main()
+{
+ typedef int T;
+ typedef std::list<T> C;
+ C c(1);
+ assert(c.back() == 0);
+ c.clear();
+ assert(c.back() == 0);
+ assert(false);
+}