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 // <initializer_list> 11 12 // template<class E> const E* begin(initializer_list<E> il); 13 14 #include <initializer_list> 15 #include <cassert> 16 17 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 18 19 struct A 20 { 21 A(std::initializer_list<int> il) 22 { 23 const int* b = begin(il); 24 const int* e = end(il); 25 assert(il.size() == 3); 26 assert(e - b == il.size()); 27 assert(*b++ == 3); 28 assert(*b++ == 2); 29 assert(*b++ == 1); 30 } 31 }; 32 33 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 34 35 int main() 36 { 37 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 38 A test1 = {3, 2, 1}; 39 #endif 40 } 41