Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/constexpr-lambda22.C

raw
1 // { dg-do compile }
2 // { dg-options -std=c++17 }
3
4 #define SA(X) static_assert((X),#X)
5
6 template<typename>
7 constexpr int
8 foo ()
9 {
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;
18 }
19
20 SA (foo<int>() == 5);