1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x 2 3 struct S { 4 int *begin(); 5 int *end(); 6 }; 7 8 struct T { 9 }; 10 11 struct Range {}; 12 int begin(Range); // expected-note {{not viable}} 13 int end(Range); 14 15 namespace 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 } 27 NS::iter begin(NS::NoADL); // expected-note {{not viable}} 28 NS::iter end(NS::NoADL); 29 30 void 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 } 38