[llvm-bugs] [Bug 24860] New: std::map::emplace calls wrong value type constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 17 09:41:20 PDT 2015


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

            Bug ID: 24860
           Summary: std::map::emplace calls wrong value type constructor
           Product: libc++
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ryancerium at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

#include <string>
#include <map>

class Thing {
public:
  Thing(const std::string &a) : mS(a) {};

private:
  Thing(const Thing&) = delete;
  Thing(Thing &&) = delete;

  std::string mS;
};    

int main(int argc, char *argv[]) {
  std::map<int, Thing> m;
  m.emplace(0, std::string("hello"));
}



This tries to call the deleted copy constructor instead of calling
Thing::Thing(const std::string &) to emplace the object in the std::map.

-- 
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/66b5a75b/attachment.html>


More information about the llvm-bugs mailing list