blob: 8cc71e5111a203b09879a64420432be8620b9359 [file] [log] [blame]
Richard Smithad762fc2011-04-14 22:09:26 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
2
3struct S {
4 int *begin();
5 int *end();
6};
7
8struct T {
9};
10
11struct Range {};
12int begin(Range); // expected-note {{not viable}}
13int end(Range);
14
15namespace NS {
16 struct ADL {};
17 struct iter {
18 int operator*();
19 bool operator!=(iter);
20 void operator++();
21 };
22 iter begin(ADL); // expected-note {{not viable}}
23 iter end(ADL);
24
25 struct NoADL {};
26}
27NS::iter begin(NS::NoADL); // expected-note {{not viable}}
28NS::iter end(NS::NoADL);
29
30void f() {
31 int a[] = {1, 2, 3};
32 for (auto b : S()) {} // ok
33 for (auto b : T()) {} // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type}}
34 for (auto b : a) {} // ok
35 for (int b : NS::ADL()) {} // ok
36 for (int b : NS::NoADL()) {} // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type}}
37}