- Add 'Allocator' requirements for `basic_string(size_type, _CharT, const
_Alloc&)`.
- Use `_M_ibegin`/`_M_iend` in `basic_string(basic_string&&, const _Alloc&)` to
avoid calling `_M_leak`.
---
libstdc++-v3/include/bits/cow_string.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/bits/cow_string.h
b/libstdc++-v3/include/bits/cow_string.h
index 0f1a2e082d0..ff60f58cd39 100644
--- a/libstdc++-v3/include/bits/cow_string.h
+++ b/libstdc++-v3/include/bits/cow_string.h
@@ -609,6 +609,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __c Character to use.
* @param __a Allocator to use (default is default allocator).
*/
+#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3076. basic_string CTAD ambiguity
+ template<typename = _RequireAllocator<_Alloc>>
+#endif
basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
: _M_dataplus(_S_construct(__n, __c, __a), __a)
{ }
@@ -706,7 +711,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
}
else
- _M_dataplus._M_p = _S_construct(__str.begin(), __str.end(), __a);
+ _M_dataplus._M_p = _S_construct(__str._M_ibegin(), __str._M_iend(),
__a);
}
#endif // C++11
--
2.53.0