43-string.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. diff --git a/include/math.h b/include/math.h
  2. index 5bde46a..33bf0eb 100644
  3. --- a/include/math.h
  4. +++ b/include/math.h
  5. @@ -326,7 +326,7 @@ extern "C++" {
  6. # undef isinf
  7. # endif
  8. -# ifdef isnan
  9. +# if defined(isnan) && !defined(_LIBCPP_MSVCRT)
  10. # undef isnan
  11. # endif
  12. diff --git a/include/string b/include/string
  13. index 123e1d6..57624c7 100644
  14. --- a/include/string
  15. +++ b/include/string
  16. @@ -703,6 +703,7 @@ struct __init_with_sentinel_tag {};
  17. template<class _CharT, class _Traits, class _Allocator>
  18. class basic_string
  19. {
  20. + static_assert(sizeof(_CharT) <= 4, "libc++ implementation of std::basic_string does not support extra-wide character types");
  21. public:
  22. typedef basic_string __self;
  23. typedef basic_string_view<_CharT, _Traits> __self_view;
  24. @@ -947,9 +948,11 @@ public:
  25. __init(__s, traits_type::length(__s));
  26. }
  27. -#if _LIBCPP_STD_VER >= 23
  28. +#if _LIBCPP_STD_VER >= 20
  29. basic_string(nullptr_t) = delete;
  30. #endif
  31. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  32. + basic_string(nullptr_t, size_t) = delete;
  33. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n)
  34. : __r_(__default_init_tag(), __default_init_tag()) {
  35. @@ -957,6 +960,9 @@ public:
  36. __init(__s, __n);
  37. }
  38. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  39. + basic_string(nullptr_t, size_t, const _Allocator&) = delete;
  40. +
  41. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  42. basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
  43. : __r_(__default_init_tag(), __a) {
  44. @@ -1120,7 +1126,7 @@ public:
  45. #endif
  46. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  47. basic_string& operator=(const value_type* __s) {return assign(__s);}
  48. -#if _LIBCPP_STD_VER >= 23
  49. +#if _LIBCPP_STD_VER >= 20
  50. basic_string& operator=(nullptr_t) = delete;
  51. #endif
  52. _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c);
  53. @@ -1182,6 +1188,13 @@ public:
  54. return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
  55. }
  56. +#if _YNDX_LIBCXX_ENABLE_STRING_RESIZE_UNINITIALIZED == 1
  57. + inline void resize_uninitialized(size_type __n)
  58. + {
  59. + __resize_default_init(__n);
  60. + }
  61. +#endif
  62. +
  63. _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c);
  64. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); }
  65. @@ -1701,7 +1714,7 @@ public:
  66. { return ends_with(__self_view(__s)); }
  67. #endif
  68. -#if _LIBCPP_STD_VER >= 23
  69. +#if _LIBCPP_STD_VER >= 20
  70. constexpr _LIBCPP_HIDE_FROM_ABI
  71. bool contains(__self_view __sv) const noexcept
  72. { return __self_view(data(), size()).contains(__sv); }