fork download
  1. #include <initializer_list>
  2.  
  3. void f(std::initializer_list<int>) {}
  4.  
  5. int main()
  6. {
  7. f{5}; // compile time error, must use f({5})
  8. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:7:6: error: expected ';' before '{' token
     f{5}; // compile time error, must use f({5})
      ^
stdout
Standard output is empty