From fc88dbd2988365dfa869d7387e1c1a1ae1e5d33d Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 23 Aug 2013 17:37:05 +0000 Subject: 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 --- .../test/strings/basic.string/string.access/index.pass.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libcxx/test/strings/basic.string/string.access/index.pass.cpp') 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 #include @@ -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 } -- cgit v1.2.3