| 1 |
// PR c++/91338 - P1161R3: Deprecate a[b,c]. |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
// { dg-options "-Wno-comma-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-bogus "top-level comma expression in array subscript is deprecated" } |
| 13 |
a[(b,c)]; |
| 14 |
|
| 15 |
a[(void) b, c]; // { dg-bogus "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-bogus "top-level comma expression in array subscript is deprecated" } |
| 19 |
a[((void) b, (void) c, (void) b, b)]; |
| 20 |
|
| 21 |
a[S(), 10]; // { dg-bogus "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-bogus "top-level comma expression in array subscript is deprecated" } |
| 26 |
a[(int{(1,2)}, int{})]; |
| 27 |
} |