2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1z / constexpr-lambda22.C
blobfcb6ff96d588a4c2eda6e31b791b009b0509e491
1 // { dg-do compile }
2 // { dg-options -std=c++17 }
4 #define SA(X) static_assert((X),#X)
6 template<typename>
7 constexpr int
8 foo ()
10   constexpr int a[] = { 1, 2, 3, 4, 5 };
11   int i = 0;
12   auto j = [&] {
13     for (auto x : a)
14       i++;
15     return i;
16   }();
17   return j;
20 SA (foo<int>() == 5);