I'm trying to compile C++11 list congregation initialization on clang++ on mac.
#include <iostream>
#include <list>
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
list<string> aList = {"abc", "def", "xyz"};
}
This is the command for the compilation.
clang++-mp-3.1 -std=c++11 iterator.cpp
I got no matching constructor error.
iterator.cpp:7:23: error: no matching constructor for initialization of
'std::list<string>'
std::list<string> aList = {"abc", "def", "xyz"};
^ ~~~~~~~~~~~~~~~~~~~~~
I tried with XCode
clang -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
I also tried with clang++ from port
clang++-mp-3.1 -v
clang version 3.1 (branches/release_31)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
I got the same result. What might be wrong?