| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-std=c++17 -O2" } */ |
| 3 |
|
| 4 |
template <int Size> struct Vector { |
| 5 |
int m_data[Size]; |
| 6 |
Vector(int, int, int) {} |
| 7 |
}; |
| 8 |
enum class E { POINTS, LINES, TRIANGLES }; |
| 9 |
|
| 10 |
__attribute__((noipa)) |
| 11 |
void getName(E type) { |
| 12 |
static E check = E::POINTS; |
| 13 |
if (type == check) |
| 14 |
check = (E)((int)check + 1); |
| 15 |
else |
| 16 |
__builtin_abort (); |
| 17 |
} |
| 18 |
|
| 19 |
int main() { |
| 20 |
int arr[]{0, 1, 2}; |
| 21 |
for (auto dim : arr) { |
| 22 |
Vector<3> localInvs(1, 1, 1); |
| 23 |
localInvs.m_data[dim] = 8; |
| 24 |
} |
| 25 |
E types[] = {E::POINTS, E::LINES, E::TRIANGLES}; |
| 26 |
for (auto primType : types) |
| 27 |
getName(primType); |
| 28 |
return 0; |
| 29 |
} |