145
|
1 // PR c++/91338 - P1161R3: Deprecate a[b,c].
|
|
2 // { dg-do compile { target c++11 } }
|
|
3 // { dg-options "-Wcomma-subscript" }
|
|
4
|
|
5 struct S {
|
|
6 int operator,(int) { return 42; }
|
|
7 };
|
|
8
|
|
9 void
|
|
10 fn (int *a, int b, int c)
|
|
11 {
|
|
12 a[b,c]; // { dg-warning "top-level comma expression in array subscript is deprecated" }
|
|
13 a[(b,c)];
|
|
14
|
|
15 a[(void) b, c]; // { dg-warning "top-level comma expression in array subscript is deprecated" }
|
|
16 a[((void) b, c)];
|
|
17
|
|
18 a[(void) b, (void) c, (void) b, b]; // { dg-warning "top-level comma expression in array subscript is deprecated" }
|
|
19 a[((void) b, (void) c, (void) b, b)];
|
|
20
|
|
21 a[S(), 10]; // { dg-warning "top-level comma expression in array subscript is deprecated" }
|
|
22 a[(S(), 10)];
|
|
23
|
|
24 a[int{(1,2)}];
|
|
25 a[int{(1,2)}, int{}]; // { dg-warning "top-level comma expression in array subscript is deprecated" }
|
|
26 a[(int{(1,2)}, int{})];
|
|
27 }
|