summaryrefslogtreecommitdiffstats
path: root/libcxx/test/strings/basic.string/string.access/index.pass.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-08-23 17:37:05 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-08-23 17:37:05 +0000
commitfc88dbd2988365dfa869d7387e1c1a1ae1e5d33d (patch)
treeae37b542af4ad74ab85bfa5650101b0e2ece2e1a /libcxx/test/strings/basic.string/string.access/index.pass.cpp
parent9217aa3b1532b76e50c6e28f4baec28557f5f978 (diff)
downloadbcm5719-llvm-fc88dbd2988365dfa869d7387e1c1a1ae1e5d33d.tar.gz
bcm5719-llvm-fc88dbd2988365dfa869d7387e1c1a1ae1e5d33d.zip
Debug mode for string. This commit also marks the first time libc++ debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib.
llvm-svn: 189114
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