aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C
blob: 99408025629229c33e363742691dedb599e334c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// PR c++/99201
// { dg-do compile { target c++17 } }

template <typename RefF>
  auto
  make_tester(const RefF& reffun)
  {
    return [=](auto in) {
      auto&& expected = [&](const auto&... vs) {
        if constexpr (sizeof(in) > 0)
          return [&](int i) { return reffun(vs[i]...); }(0);
        else
          return [&](int i) { return reffun(vs[i]...); }(0);
      };
    };
  }

int main()
{
  make_tester([](int x) { return x; })(0);
  return 0;
}