The following code compiles in g ++ (various versions), but does not work on clang ++ - 3.4 with libC ++ on my system:
#include <map>
#include <string>
std::map<std::string, std::string> f() {
return {};
}
int main() {
auto m = f();
}
clang notes the following problem:
x.cpp:6:12: error: chosen constructor is explicit in copy-initialization
return {};
^~
/usr/local/Cellar/llvm34/3.4.2/lib/llvm-3.4/bin/../include/c++/v1/map:838:14: note: constructor declared here
explicit map(const key_compare& __comp = key_compare())
^
In fact, the include file declares the constructor as explicit. But it is not marked as such in my standard C ++ 11 project.Is this a bug in clang ++ / libC ++? I could not find the appropriate error report.
source
share