I have clang ++ 4.2
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn) Target: x86_64-apple-darwin11.4.2 Thread model: posix
When I tried to compile this C ++ 11 code:
class ContextSummary { int id; int hops; std::map<std::string, int> db {}; std::time_t timestamp; ContextSummary(int id, const std::map<std::string, int>& db = {}, int hops = 3, std::time_t timestamp = 0) { this->id = id; this->db = db; this->hops = hops; this->timestamp = timestamp; }
I received this error message. Code works fine with g ++ 4.8
error: chosen constructor is explicit in copy-initialization ...id, const std::map<std::string, int>& db = {}, int hops = 3, std::time_t... ^ ~~
Is this a clang ++ error? How can I get around this error?
source share