1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
12 struct DeletedEnd
: public T
{
14 Data
*end() = delete; //expected-note {{'end' has been explicitly marked deleted here}}
17 struct DeletedADLBegin
{ };
19 int* begin(DeletedADLBegin
) = delete; //expected-note {{candidate function has been explicitly deleted}} \
20 expected
-note
6 {{candidate function
not viable
: no known conversion
}}
26 Data
*end(); // expected-note 2 {{declared private here}}
30 Data
* begin(ADLNoEnd
); // expected-note 7 {{candidate function not viable: no known conversion}}
32 struct OverloadedStar
{
40 for (auto i
: pt
) { } // expected-error{{invalid range expression of type 'T *'; did you mean to dereference it with '*'?}}
43 for (auto i
: arr
) { }
45 for (auto i
: parr
) { }// expected-error{{invalid range expression of type 'int (*)[10]'; did you mean to dereference it with '*'?}}
48 for (auto i
: NB
) { }// expected-error{{invalid range expression of type 'NoBegin'; no viable 'begin' function available}}
50 for (auto i
: pNB
) { }// expected-error{{invalid range expression of type 'NoBegin *'; no viable 'begin' function available}}
52 for (auto i
: ppNB
) { }// expected-error{{invalid range expression of type 'NoBegin **'; no viable 'begin' function available}}
54 for (auto i
: pppppNB
) { }// expected-error{{invalid range expression of type 'NoBegin *****'; no viable 'begin' function available}}
57 for (auto i
: ANE
) { } // expected-error{{invalid range expression of type 'ADLNoEnd'; no viable 'end' function available}}
59 for (auto i
: pANE
) { } // expected-error{{invalid range expression of type 'ADLNoEnd *'; no viable 'begin' function available}}
62 for (auto i
: DE
) { } // expected-error{{attempt to use a deleted function}} \
63 expected
-note
{{when looking up
'end' function
for range expression of type
'DeletedEnd'}}
66 for (auto i
: pDE
) { } // expected-error {{invalid range expression of type 'DeletedEnd *'; no viable 'begin' function available}}
69 // FIXME: This diagnostic should be improved, as it does not specify that
70 // the range is invalid.
71 for (auto i
: PE
) { } // expected-error{{'end' is a private member of 'PrivateEnd'}}
74 for (auto i
: pPE
) { }// expected-error {{invalid range expression of type 'PrivateEnd *'}}
75 // expected-error@-1 {{'end' is a private member of 'PrivateEnd'}}
78 for (auto i
: DAB
) { } // expected-error {{call to deleted function 'begin'}}\
79 expected
-note
{{when looking up
'begin' function
for range expression of type
'DeletedADLBegin'}}
82 for (auto i
: *OS
) { }
84 for (auto i
: OS
) { } // expected-error {{invalid range expression of type 'OverloadedStar'; did you mean to dereference it with '*'?}}
86 for (Data
*p
: pt
) { } // expected-error {{invalid range expression of type 'T *'; did you mean to dereference it with '*'?}}
87 // expected-error@-1 {{no viable conversion from 'Data' to 'Data *'}}
88 // expected-note@4 {{selected 'begin' function with iterator type 'Data *'}}