Skip to content

Commit 24e9d4e

Browse files
committed
[NFC] Add forRangeNotWarnCases in test file
1 parent f6c129b commit 24e9d4e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

clang-tools-extra/test/clang-tidy/checkers/modernize/use-structured-binding.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,35 @@ void forRangeWarnCases() {
102102
}
103103
}
104104

105+
void forRangeNotWarnCases() {
106+
std::pair<int, int> Pairs[10];
107+
for (auto P : Pairs) {
108+
int x = P.first;
109+
MarkUsed(x);
110+
int y = P.second;
111+
}
112+
113+
for (auto P : Pairs) {
114+
MarkUsed(P);
115+
int x = P.first;
116+
int y = P.second;
117+
}
118+
119+
for (auto P : Pairs) {
120+
int x = P.first;
121+
int y = P.second;
122+
MarkUsed(P);
123+
}
124+
125+
std::pair<TestClass, TestClass> ClassPairs[10];
126+
int c;
127+
for (auto P : ClassPairs) {
128+
TestClass c1 = P.first;
129+
c ++ ;
130+
TestClass c2 = P.second;
131+
}
132+
}
133+
105134
void stdTieWarnCases() {
106135
int a = 0;
107136
int b = 0;

0 commit comments

Comments
 (0)