[llvm-bugs] [Bug 24860] std::map::emplace calls wrong value type constructor
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 17 10:04:10 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24860
David Blaikie <dblaikie at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |dblaikie at gmail.com
Resolution|--- |INVALID
--- Comment #1 from David Blaikie <dblaikie at gmail.com> ---
This seems to be working as intended & doesn't seem to be related to std::map.
Your emplace call is roughly equivalent to this construction of a std::pair:
std::pair<int, Thing> p(0, std::string("hello"));
which exhibits the same compilation error as your std::map::emplace call.
The reason is that std::is_convertible<std::string, Thing>::value is false.
This is because Thing is not copy or move constructible, which is curious, but
technically the way that std::is_convertible is defined:
"the predicate condition for a template specialization is_convertible<From, To>
shall be satisfied if and only if the return expression in the following code
would be well-formed, including any implicit conversions to the return type of
the function:
To test() {
return create<From>();
}"
--
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/20150917/bf459f93/attachment.html>
More information about the llvm-bugs
mailing list