@@ -24,6 +24,14 @@ void DecomposeByAssignWarnCases() {
24
24
// CHECK-FIXES-ALL: // REMOVE
25
25
}
26
26
27
+ {
28
+ auto P = getPair<int , int >();
29
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
30
+ // CHECK-FIXES-ALL: auto [x, y] = getPair<int, int>();
31
+ int x = P.first , y = P.second ; // REMOVE
32
+ // CHECK-FIXES-ALL: // REMOVE
33
+ }
34
+
27
35
{
28
36
auto P = getPair<int , int >();
29
37
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:5: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
@@ -78,6 +86,13 @@ void forRangeWarnCases() {
78
86
// CHECK-FIXES-ALL: // REMOVE
79
87
}
80
88
89
+ for (auto P : Pairs) {
90
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
91
+ // CHECK-FIXES-ALL: for (auto [x, y] : Pairs) {
92
+ int x = P.first , y = P.second ; // REMOVE
93
+ // CHECK-FIXES-ALL: // REMOVE
94
+ }
95
+
81
96
for (const auto P : Pairs) {
82
97
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:8: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
83
98
// CHECK-FIXES-ALL: for (const auto [x, y] : Pairs) {
@@ -169,6 +184,12 @@ void stdTieWarnCases() {
169
184
// CHECK-MESSAGES-ALL: :[[@LINE-1]]:3: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
170
185
// CHECK-FIXES-ALL: auto [a, b] = getPair<int, int>();
171
186
187
+ int x = 0 , y = 0 ; // REMOVE
188
+ // CHECK-FIXES-ALL: // REMOVE
189
+ std::tie (x, y) = getPair<int , int >();
190
+ // CHECK-MESSAGES-ALL: :[[@LINE-1]]:3: warning: use structured binding to decompose a pair [modernize-use-structured-binding]
191
+ // CHECK-FIXES-ALL: auto [x, y] = getPair<int, int>();
192
+
172
193
int * pa = nullptr ; // REMOVE
173
194
// CHECK-FIXES-ALL: // REMOVE
174
195
int * pb = nullptr ; // REMOVE
0 commit comments