[libc++] Fix PR 31938 - std::basic_string constructors use non-deductible parameter types.

Summary:
This patch fixes http://llvm.org/PR31938. The description below is copy/pasted from the bug:

The standard says:

template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<charT>>
class basic_string {
  using value_type = typename traits::char_type;
  // ...
  basic_string(const charT* s, const Allocator& a = Allocator());
};

libc++ actually chooses to declare the constructor as

  basic_string(const value_type* s, const Allocator& a = Allocator());

The implicit deduction guides from class template argument deduction make what was previously an implementation detail visible:

std::basic_string s = "foo"; // error, can't deduce charT.

The constructor in question is in the libc++ DSO, but fortunately it looks like fixing this will not result in an ABI break.


@rsmith How does this look? I did more than just the constructors mentioned in the PR, but IDK how far to take it.


Reviewers: mclow.lists, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, rsmith

Differential Revision: https://reviews.llvm.org/D29863

llvm-svn: 295393
diff --git a/libcxx/test/support/constexpr_char_traits.hpp b/libcxx/test/support/constexpr_char_traits.hpp
index 2136b26..7508567 100644
--- a/libcxx/test/support/constexpr_char_traits.hpp
+++ b/libcxx/test/support/constexpr_char_traits.hpp
@@ -12,6 +12,7 @@
 #define _CONSTEXPR_CHAR_TRAITS
 
 #include <string>
+#include <cassert>
 
 #include "test_macros.h"
 
@@ -118,7 +119,7 @@
 TEST_CONSTEXPR_CXX14 _CharT*
 constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
 {
-    _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
+    assert(__s2 < __s1 || __s2 >= __s1+__n);
     char_type* __r = __s1;
     for (; __n; --__n, ++__s1, ++__s2)
         assign(*__s1, *__s2);