aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/range-for14.C
blob: 94ff3c19153dc9832224a41b28587de6cd074f2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR c++/87152
// { dg-do run }
// { dg-options "-std=c++2a" }

template<typename T>
void
fn ()
{
  T a[] = { 1, 2, 3, 4, 5 };

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

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

int
main ()
{
  fn<int>();
}