// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: clang-modernize -loop-convert %t.cpp -- -I %S/Inputs -std=c++11 // RUN: FileCheck -input-file=%t.cpp %s // XFAIL: * struct MyArray { unsigned size(); }; template struct MyContainer { }; int *begin(const MyArray &Arr); int *end(const MyArray &Arr); template T *begin(const MyContainer &C); template T *end(const MyContainer &C); // The Loop Convert Transform doesn't detect free functions begin()/end() and // so fails to transform these cases which it should. void f() { MyArray Arr; for (unsigned i = 0, e = Arr.size(); i < e; ++i) {} // CHECK: for (auto & elem : Arr) {} MyContainer C; for (int *I = begin(C), *E = end(C); I != E; ++I) {} // CHECK: for (auto & elem : C) {} }