fork download
  1. #include <array>
  2.  
  3. class foo
  4. {
  5. public:
  6. foo(std::array<std::array<int, 2>, 3> arr) { }
  7. };
  8.  
  9. int main()
  10. {
  11. foo f({{1, 2}, {3, 4}, {5, 6}});
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:11:35: error: no matching function for call to ‘foo::foo(<brace-enclosed initializer list>)’
     foo f({{1, 2}, {3, 4}, {5, 6}});
                                   ^
prog.cpp:6:5: note: candidate: foo::foo(std::array<std::array<int, 2ul>, 3ul>)
     foo(std::array<std::array<int, 2>, 3> arr) { }
     ^~~
prog.cpp:6:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘std::array<std::array<int, 2ul>, 3ul>’
prog.cpp:3:7: note: candidate: constexpr foo::foo(const foo&)
 class foo
       ^~~
prog.cpp:3:7: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const foo&’
prog.cpp:3:7: note: candidate: constexpr foo::foo(foo&&)
prog.cpp:3:7: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘foo&&’
stdout
Standard output is empty