Consider simple code snippet
#include <map>
#include <string>
struct Foo
{
Foo(const std::map<std::string, int> & bar = std::map<std::string, int>())
:bar(bar)
{ }
std::map<std::string, int> bar;
};
int main(int argc, char ** argv)
{
return 0;
}
When I compile it like this: clang++ -o foo foo.cpp
I face errors:
foo.cpp:7:73: error: expected ')'
Foo(const std::map<std::string, int> bar = std::map<std::string, int>())
^
foo.cpp:7:8: note: to match this '('
Foo(const std::map<std::string, int> bar = std::map<std::string, int>())
^
foo.cpp:7:68: error: expected '>'
Foo(const std::map<std::string, int> bar = std::map<std::string, int>())
^
Same behaviour for clang 3.2 and clang 3.3.
So I am wondering if I missing something or is it a bug? GCC does not complain.
{}
instead of()
?()
to{}
had any chance to fix it :)