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

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 11 02:47:27 PST 2017


EricWF added inline comments.


================
Comment at: include/string:782
     _LIBCPP_INLINE_VISIBILITY
     basic_string(const value_type* __s, size_type __n);
     _LIBCPP_INLINE_VISIBILITY
----------------
rsmith wrote:
> Did you skip this one intentionally?
Yes. `size_type`  is a typedef for `allocator_traits<Allocator>::size_type`, This causes the `basic_string(CharT*, Allocator const&)` to always be chosen instead, resulting in a incorrect allocator type.


================
Comment at: include/string:788
     _LIBCPP_INLINE_VISIBILITY
     basic_string(size_type __n, value_type __c, const allocator_type& __a);
     basic_string(const basic_string& __str, size_type __pos, size_type __n,
----------------
rsmith wrote:
> Likewise these two.
I thought they would suffer the same fate as the above overload but that is not the case. I'll update after reviewing each constructor.


================
Comment at: include/string:812
     _LIBCPP_INLINE_VISIBILITY
     basic_string(initializer_list<value_type> __il, const allocator_type& __a);
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
----------------
rsmith wrote:
> And these
Just making sure I was on the right track first.


https://reviews.llvm.org/D29863





More information about the cfe-commits mailing list