@@ -6,6 +6,7 @@ void f1(int &x) {} // Function that takes a non-const integer reference
66void g1 (int *x) {} // Function that takes a non-const integer pointer
77void f2 (const int &x) {} // Function that takes a non-const integer reference
88void g2 (const int *x) {} // Function that takes a non-const integer pointer
9+ void f3 (int *const x) {}
910
1011int h1 () { return 1 ; }
1112constexpr int h2 () { return 1 ; }
@@ -198,6 +199,11 @@ int main() {
198199 const int *m = &i;
199200 }
200201
202+ for (int i = j; i < k; i += l) { // NON-COMPLIANT: The loop counter is taken
203+ // as a const but mutable pointer
204+ int *const m = &i;
205+ }
206+
201207 for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop bound is taken as
202208 // a non-const reference
203209 int &m = k;
@@ -218,6 +224,11 @@ int main() {
218224 const int *m = &k;
219225 }
220226
227+ for (int i = j; i < k; i += l) { // NON-COMPLIANT: The loop bound is taken as
228+ // a const but mutable pointer
229+ int *const m = &k;
230+ }
231+
221232 for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop step is taken as
222233 // a non-const reference
223234 int &m = l;
@@ -238,6 +249,11 @@ int main() {
238249 const int *m = &l;
239250 }
240251
252+ for (int i = j; i < k; i += l) { // NON-COMPLIANT: The loop step is taken as
253+ // a const but mutable pointer
254+ int *const m = &l;
255+ }
256+
241257 for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop counter is passed
242258 // to a non-const reference parameter
243259 f1 (i);
@@ -258,6 +274,11 @@ int main() {
258274 g2 (&i);
259275 }
260276
277+ for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop counter is passed
278+ // to a const but mutable pointer parameter
279+ f3 (&i);
280+ }
281+
261282 for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop bound is passed to
262283 // a non-const reference parameter
263284 f1 (k);
@@ -279,6 +300,11 @@ int main() {
279300 g2 (&k);
280301 }
281302
303+ for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop bound is passed to
304+ // a const but mutable pointer parameter
305+ f3 (&k);
306+ }
307+
282308 for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop step is passed to
283309 // a non-const reference parameter
284310 f1 (l);
@@ -298,4 +324,9 @@ int main() {
298324 // a const pointer parameter
299325 g2 (&l);
300326 }
327+
328+ for (int i = j; i < k; i += l) { // NON_COMPLIANT: The loop step is passed to
329+ // a const but mutable pointer parameter
330+ f3 (&l);
331+ }
301332}
0 commit comments