[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
Fri Feb 10 19:55:28 PST 2017


EricWF created this revision.

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.


https://reviews.llvm.org/D29863

Files:
  include/string
  test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29863.88083.patch
Type: text/x-patch
Size: 4325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170211/dfd89da9/attachment.bin>


More information about the cfe-commits mailing list