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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189114 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__debug b/include/__debug
index bac580c..f1805ad 100644
--- a/include/__debug
+++ b/include/__debug
@@ -11,6 +11,10 @@
 #ifndef _LIBCPP_DEBUG_H
 #define _LIBCPP_DEBUG_H
 
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
 #if _LIBCPP_DEBUG_LEVEL >= 1
 
 #   include <cstdlib>
@@ -24,10 +28,6 @@
 
 #if _LIBCPP_DEBUG_LEVEL >= 2
 
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 struct _LIBCPP_TYPE_VIS __c_node;
@@ -38,8 +38,15 @@
     __i_node* __next_;
     __c_node* __c_;
 
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
     __i_node(const __i_node&) = delete;
     __i_node& operator=(const __i_node&) = delete;
+#else
+private:
+    __i_node(const __i_node&);
+    __i_node& operator=(const __i_node&);
+public:
+#endif
     _LIBCPP_INLINE_VISIBILITY
     __i_node(void* __i, __i_node* __next, __c_node* __c)
         : __i_(__i), __next_(__next), __c_(__c) {}
@@ -54,8 +61,15 @@
     __i_node** end_;
     __i_node** cap_;
 
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
     __c_node(const __c_node&) = delete;
     __c_node& operator=(const __c_node&) = delete;
+#else
+private:
+    __c_node(const __c_node&);
+    __c_node& operator=(const __c_node&);
+public:
+#endif
     _LIBCPP_INLINE_VISIBILITY
     __c_node(void* __c, __c_node* __next)
         : __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
@@ -134,8 +148,15 @@
 
     __libcpp_db();
 public:
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
     __libcpp_db(const __libcpp_db&) = delete;
     __libcpp_db& operator=(const __libcpp_db&) = delete;
+#else
+private:
+    __libcpp_db(const __libcpp_db&);
+    __libcpp_db& operator=(const __libcpp_db&);
+public:
+#endif
     ~__libcpp_db();
 
     class __db_c_iterator;