gcc/testsuite/g++.dg/pr108520.C
raw| 1 | // { dg-do compile { target c++23 } } |
| 2 | // { dg-options "-O2" } |
| 3 | |
| 4 | static void foo () {} |
| 5 | struct S { void (*f) (); }; |
| 6 | |
| 7 | [[gnu::nonnull (1)]] |
| 8 | void |
| 9 | bar (void *x) |
| 10 | { |
| 11 | struct S a[3] = { { foo }, { foo }, { foo } }; |
| 12 | for (struct S *i = a, *e = a + 3; i != e; i++) |
| 13 | { |
| 14 | [[assume (i->f)]]; |
| 15 | i->f (); |
| 16 | } |
| 17 | } |