Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
Sebastian Redl | ce7cd26 | 2011-05-20 21:07:01 +0000 | [diff] [blame] | 2 | // XFAIL: * |
| 3 | |
| 4 | template <typename T, typename U> |
| 5 | struct same_type { static const bool value = false; }; |
| 6 | template <typename T> |
| 7 | struct same_type<T, T> { static const bool value = true; }; |
| 8 | |
| 9 | namespace std { |
| 10 | typedef decltype(sizeof(int)) size_t; |
| 11 | |
| 12 | // libc++'s implementation |
| 13 | template <class _E> |
| 14 | class initializer_list |
| 15 | { |
| 16 | const _E* __begin_; |
| 17 | size_t __size_; |
| 18 | |
| 19 | initializer_list(const _E* __b, size_t __s) |
| 20 | : __begin_(__b), |
| 21 | __size_(__s) |
| 22 | {} |
| 23 | |
| 24 | public: |
| 25 | typedef _E value_type; |
| 26 | typedef const _E& reference; |
| 27 | typedef const _E& const_reference; |
| 28 | typedef size_t size_type; |
| 29 | |
| 30 | typedef const _E* iterator; |
| 31 | typedef const _E* const_iterator; |
| 32 | |
| 33 | initializer_list() : __begin_(nullptr), __size_(0) {} |
| 34 | |
| 35 | size_t size() const {return __size_;} |
| 36 | const _E* begin() const {return __begin_;} |
| 37 | const _E* end() const {return __begin_ + __size_;} |
| 38 | }; |
| 39 | } |
| 40 | |
Sebastian Redl | 262b62b | 2011-06-05 12:23:08 +0000 | [diff] [blame] | 41 | namespace litb { |
| 42 | |
| 43 | // invalid |
| 44 | struct A { int a[2]; A():a({1, 2}) { } }; // expected-error {{}} |
| 45 | |
| 46 | // invalid |
| 47 | int a({0}); // expected-error {{}} |
| 48 | |
| 49 | // invalid |
| 50 | int const &b({0}); // expected-error {{}} |
| 51 | |
Sebastian Redl | 262b62b | 2011-06-05 12:23:08 +0000 | [diff] [blame] | 52 | } |