summaryrefslogtreecommitdiffstats
path: root/libcxx/test/strings/basic.string/string.access/index.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/strings/basic.string/string.access/index.pass.cpp')
-rw-r--r--libcxx/test/strings/basic.string/string.access/index.pass.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcxx/test/strings/basic.string/string.access/index.pass.cpp b/libcxx/test/strings/basic.string/string.access/index.pass.cpp
index b5643533b00..76709fea899 100644
--- a/libcxx/test/strings/basic.string/string.access/index.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.access/index.pass.cpp
@@ -12,6 +12,10 @@
// const_reference operator[](size_type pos) const;
// reference operator[](size_type pos);
+#ifdef _LIBCPP_DEBUG2
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
#include <string>
#include <cassert>
@@ -47,4 +51,13 @@ int main()
assert(s2[0] == '\0');
}
#endif
+#ifdef _LIBCPP_DEBUG2
+ {
+ std::string s;
+ char c = s[0];
+ assert(c == '\0');
+ c = s[1];
+ assert(false);
+ }
+#endif
}
OpenPOWER on IntegriCloud