1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // UNSUPPORTED: c++03 |
10 | |
11 | // template<class E> class initializer_list; |
12 | // |
13 | // If an explicit specialization or partial specialization of initializer_list |
14 | // is declared, the program is ill-formed. |
15 | |
16 | #include <initializer_list> |
17 | |
18 | #if !__has_warning("-Winvalid-specializations") |
19 | // expected-no-diagnostics |
20 | #else |
21 | |
22 | // expected-error@+2 {{'initializer_list' cannot be specialized: Users are not allowed to specialize this standard library entity}} |
23 | template <> |
24 | class std::initializer_list<int> { |
25 | }; //expected-error 0-1 {{explicit specialization of 'std::initializer_list<int>' after instantiation}} |
26 | |
27 | // expected-error@+2 {{'initializer_list' cannot be specialized: Users are not allowed to specialize this standard library entity}} |
28 | template <typename T> |
29 | class std::initializer_list<T*> {}; |
30 | |
31 | #endif |
32 | |