fork download
  1. #include <iostream>
  2. #include <initializer_list>
  3. #include <array>
  4.  
  5. int main() {
  6.  
  7. int arr1[] = { 1, 2, 3 }; // OK
  8. std::array<int, 3> arr2 = { 1, 2, 3 }; // OK
  9.  
  10. std::initializer_list<int> il = { 1, 2, 3 };
  11. constexpr std::initializer_list<int> il_constexpr = { 1, 2, 3 };
  12.  
  13. //int arr3[] = il; // error
  14. //int arr4[] = il_constexpr; // error
  15.  
  16. //std::array<int, 3> arr5 = il; // error
  17. //std::array<int, 3> arr6 = il_constexpr; // error
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Standard output is empty