[llvm-bugs] [Bug 24933] std::basic_string requires Allocator to have a default constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 24 21:48:49 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24933

Jesse Hall <jhall1024+llvmbugs at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Jesse Hall <jhall1024+llvmbugs at gmail.com> ---
You're right. I'm terribly sorry. I was trying to simplify from something more
complex, came up with the same error, and assumed I'd simplified correctly.

For what it's worth, the real problem is essentially:

typedef std::basic_string<char, std::char_traits<char>, MyAllocator<char>>
MyString;
typedef std::unordered_map<MyString, void*, std::hash<MyString>,
std::equal_to<MyString>, MyAllocator<std::pair<const MyString, void*>>>
MyUnorderedMap;
...
MyUnorderedMap um;
um.insert(std::make_pair(str, ptr));

Something in insert() is default-constructing the pair<MyString,void*>, which
default-constructs MyString, and fails.

I'll go do my homework properly this time and figure out if this is
expected/correct, and if so, whether there's a valid way to avoid the default
construction.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150925/ff4689d1/attachment.html>


More information about the llvm-bugs mailing list