xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/for-range-unused.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wunused
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // PR9968: We used to warn that __range is unused in a dependent for-range.
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc template <typename T>
6*f4a2713aSLionel Sambuc   struct Vector {
doItVector7*f4a2713aSLionel Sambuc     void doIt() {
8*f4a2713aSLionel Sambuc       int a; // expected-warning {{unused variable 'a'}}
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc       for (auto& e : elements) // expected-warning {{unused variable 'e'}}
11*f4a2713aSLionel Sambuc         ;
12*f4a2713aSLionel Sambuc     }
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc     T elements[10];
15*f4a2713aSLionel Sambuc   };
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc 
main(int,char **)18*f4a2713aSLionel Sambuc int main(int, char**) {
19*f4a2713aSLionel Sambuc   Vector<int>    vector;
20*f4a2713aSLionel Sambuc   vector.doIt(); // expected-note {{here}}
21*f4a2713aSLionel Sambuc }
22