我有铿锵++ 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
当我试图编译这个 c++11 代码时:
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;
}
我收到此错误消息。该代码适用于 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...
^ ~~
这是clang++错误吗?我怎样才能绕过这个错误?