1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // template<class E> class initializer_list; 11 12 // const E* begin() const; 13 // const E* end() const; 14 // size_t size() const; 15 16 #include <initializer_list> 17 #include <cassert> 18 19 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 20 21 struct A 22 { 23 A(std::initializer_list<int> il) 24 { 25 const int* b = il.begin(); 26 const int* e = il.end(); 27 assert(il.size() == 3); 28 assert(e - b == il.size()); 29 assert(*b++ == 3); 30 assert(*b++ == 2); 31 assert(*b++ == 1); 32 } 33 }; 34 35 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 36 37 int main() 38 { 39 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 40 A test1 = {3, 2, 1}; 41 #endif 42 } 43