1 // RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fms-extensions -std=c++20 -verify=expected,both %s
2 // RUN: %clang_cc1 -std=c++20 -fms-extensions -verify=ref,both %s
5 typedef decltype(sizeof(int)) size_t;
12 initializer_list(const _E
* __b
, size_t __s
)
18 typedef _E value_type
;
19 typedef const _E
& reference
;
20 typedef const _E
& const_reference
;
21 typedef size_t size_type
;
23 typedef const _E
* iterator
;
24 typedef const _E
* const_iterator
;
26 constexpr initializer_list() : __begin_(nullptr), __size_(0) {}
28 constexpr size_t size() const {return __size_
;}
29 constexpr const _E
* begin() const {return __begin_
;}
30 constexpr const _E
* end() const {return __begin_
+ __size_
;}
37 constexpr Thing(int m
) : m(m
) {}
38 constexpr bool operator==(const Thing
& that
) const {
39 return this->m
== that
.m
;
43 constexpr bool is_contained(std::initializer_list
<Thing
> Set
, const Thing
&Element
) {
44 return (*Set
.begin() == Element
);
50 return is_contained({a
}, b
);
53 static_assert(foo() == 0);
56 namespace rdar13395022
{
57 struct MoveOnly
{ // both-note {{candidate}}
58 MoveOnly(MoveOnly
&&); // both-note 2{{copy constructor is implicitly deleted because}} both-note {{candidate}}
61 void test(MoveOnly mo
) {
62 auto &&list1
= {mo
}; // both-error {{call to implicitly-deleted copy constructor}} both-note {{in initialization of temporary of type 'std::initializer_list}}
63 MoveOnly (&&list2
)[1] = {mo
}; // both-error {{call to implicitly-deleted copy constructor}} both-note {{in initialization of temporary of type 'MoveOnly[1]'}}
64 std::initializer_list
<MoveOnly
> &&list3
= {};
65 MoveOnly (&&list4
)[1] = {}; // both-error {{no matching constructor}}
66 // both-note@-1 {{in implicit initialization of array element 0 with omitted initializer}}
67 // both-note@-2 {{in initialization of temporary of type 'MoveOnly[1]' created to list-initialize this reference}}