Debian Codegraph @

clang/test/SemaCXX/embed-init-list.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-c23-extensions %s
2 // expected-no-diagnostics
3
4 namespace std {
5 typedef decltype(sizeof(int)) size_t;
6
7 template <class _E> class initializer_list {
8 const _E *__begin_;
9 size_t __size_;
10
11 constexpr initializer_list(const _E *__b, size_t __s)
12 : __begin_(__b), __size_(__s) {}
13
14 public:
15 constexpr initializer_list() : __begin_(nullptr), __size_(0) {}
16 };
17 } // namespace std
18
19 template <typename T> struct S {
20 S(std::initializer_list<T>);
21 };
22
23 template <> struct S<char> {
24 S(std::initializer_list<char>);
25 };
26
27 struct S1 {
28 S<char> data;
29 int a;
30 };
31
32 template <typename _Tp, std::size_t _Nm> void to_array(_Tp (&&__a)[_Nm]) {}
33
34
35 template<typename T>
36 void tfn(T) {}
37
38 void tests() {
39
40 S<char>{{
41 #embed __FILE__
42 }};
43
44 S1 ss{std::initializer_list<char>{
45 #embed __FILE__
46 }};
47
48 S sss = {
49 #embed __FILE__
50 };
51
52 std::initializer_list<int> il{
53 #embed __FILE__
54 };
55
56 static constexpr auto initializer_list = std::initializer_list<char>{
57 #embed __FILE__
58 , '\0'};
59
60 static constexpr auto intinitializer_list = std::initializer_list<int>{
61 #embed __FILE__
62 , '\0'};
63
64 to_array({
65 #embed __FILE__
66 });
67
68 tfn<std::initializer_list<int>>({
69 #embed __FILE__
70 });
71 }