PR c++/80290
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr81719.C
blob6e017afbae242312f6e11884426f4e04d2e8b374
1 /* { dg-do compile { target c++11 } } */
2 /* { dg-options "-O3 -fdump-tree-optimized" } */
4 typedef int Items[2];
6 struct ItemArray
8   Items items;
9   int sum_x2() const;
12 int ItemArray::sum_x2() const
14   int total = 0;
15   for (int item : items)
16     {
17       total += item;
18     }
19   return total;
22 /* We should be able to compute the number of iterations to two, unroll
23    the loop and end up with a single basic-block in sum_x2.  */
24 /* { dg-final { scan-tree-dump-times "bb" 1 "optimized" } } */