blob: 80a4e9fa04bca164be4128fa495ae6e7d9e92594 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
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
19struct 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
33int main()
34{
Howard Hinnant73d21a42010-09-04 23:28:19 +000035#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000036 A test1 = {3, 2, 1};
37#endif
38}