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