Could somebody tell me the theory behind this?
Why the last call doesn't compile?
test.cc: In function ‘int main()’: test.cc:15:12: error: too many braces around initializer for ‘int’ [-fpermissive] test.cc:15:12:
error: invalid conversion from ‘’ to ‘int’ [-fpermissive] test.cc:9:6: error: initializing argument 1 of ‘void f(std::initializer_list)’ [-fpermissive] test.cc:15:12:
error: aggregate value used where an integer was expected
I think either c++11 or g++ 4.7 is broken on this. Thank you!
#include <initializer_list> class A { public: A(const std::initializer_list<int>) {} }; void f(const std::initializer_list<int>) {} int main() { A({1}); // Compile OK f({1}); // Compile OK A({{{1}}}); // Compile OK //f({{{1}}}); // Compile Error. }