aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/range-for6.C
blob: 4cee60a839e19cdcdb0d06d2112c448286773186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// P0614R1
// { dg-do run }
// { dg-options "-std=c++2a" }

int
main ()
{
  int a[] = { 1, 2, 3, 4, 5 };

  for (int i = []{ return 3; }(); auto x : a)
    if (i != 3)
      __builtin_abort ();

  for (int i = ({ 3; }); auto x : a)
    if (i != 3)
      __builtin_abort ();
}