Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. 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 | struct A |
| 20 | { |
| 21 | A(std::initializer_list<int> il) |
| 22 | { |
| 23 | const int* b = il.begin(); |
| 24 | const int* e = il.end(); |
| 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 | int main() |
| 34 | { |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 35 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 36 | A test1 = {3, 2, 1}; |
| 37 | #endif |
| 38 | } |