You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inti=memcmp_test(p, "hello", ++len); // expected-error {{increment expression not allowed in argument for parameter used in function parameter bounds expression}} \
244
+
// expected-error {{increment expression not allowed in argument for parameter used in function parameter bounds expression}}
245
+
}
246
+
247
+
// Checked pointers in unchecked scope
248
+
voidf106_u1()
249
+
{
250
+
intlen=4;
251
+
_Nt_array_ptr<char>p : count(5) ="hello";
252
+
inti=memcmp_test(p, "hello", ++len); // expected-error {{increment expression not allowed in argument for parameter used in function parameter bounds expression}}
253
+
}
254
+
255
+
// Unchecked pointers in unchecked scope
256
+
voidf106_u2()
257
+
{
258
+
intlen=4;
259
+
char*p="hello";
260
+
inti=memcmp_test(p, "hello", ++len);
261
+
}
262
+
263
+
// Checked pointers in checked scope
264
+
voidf107()
265
+
_Checked
266
+
{
267
+
intlen=4;
268
+
intp_Checked [5] = {'h', 'e', 'l', 'l', 'o'};
269
+
_Array_ptr<int>pos=memchr_test(p, 'l', ++len); // expected-error {{increment expression not allowed in argument for parameter used in function return bounds expression}} \
270
+
// expected-error {{increment expression not allowed in argument for parameter used in function parameter bounds expression}}
271
+
}
272
+
273
+
// Checked pointers in unchecked scope
274
+
voidf107_u1()
275
+
{
276
+
intlen=4;
277
+
intp_Checked [5] = {'h', 'e', 'l', 'l', 'o'};
278
+
// Ideally, there should be an error for modifying expressions
279
+
// used in the return bounds expression also.
280
+
_Array_ptr<int>pos=memchr_test(p, 'l', ++len); // expected-error {{increment expression not allowed in argument for parameter used in function parameter bounds expression}}
281
+
}
282
+
283
+
// Unchecked pointers in unchecked scope
284
+
voidf107_u2()
285
+
{
286
+
intlen=4;
287
+
intp[5] = {'h', 'e', 'l', 'l', 'o'};
288
+
int*pos=memchr_test(p, 'l', ++len);
289
+
}
290
+
291
+
// Checked pointers in checked scope
292
+
voidf108()
293
+
_Checked
294
+
{
295
+
intlen=5;
296
+
_Array_ptr<char>p=malloc_test<char>(++len); // expected-error {{increment expression not allowed in argument for parameter used in function return bounds expression}}
297
+
}
298
+
299
+
// Checked pointers in unchecked scope
300
+
voidf108_u1()
301
+
{
302
+
intlen=5;
303
+
// Ideally, there should be an error for modifying expressions
0 commit comments