aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/lambda-scope7.C
blob: 6db39bd8692cf1c4ac7a72a32689cd7ec0174d88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// P2036R3 - Change scope of lambda trailing-return-type
// PR c++/102610
// { dg-do compile { target c++14_only } }

template <typename T>
inline constexpr auto
equal1 (T &&t)
{
  return [t = 3](const auto& obj) -> decltype(obj == t)
    {
      return obj == t;
    };
}

void
g ()
{
  constexpr auto l1 = equal1 (5); // { dg-error "not literal" }
  static_assert (l1 (3), "");	  // { dg-error "non-constant|non-.constexpr." }
}