summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const4.C
blob: 52f4373ccbdfe35e1fbc854b16f890b041139fd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// PR c++/81525
// { dg-do compile { target c++14 } }

template <int i> struct A {
  constexpr operator int () const { return i; }
};
template <int i> constexpr A<i> a = {};

template <typename F> void foo (F f) {
  f (A<0>{});
}
template <typename T>
void bar (T) {
  constexpr auto N = a<1>;
  auto f = [&] (auto i) {
    static_assert (static_cast<int>(N) == 1, "");
  };
  foo (f);
}
int main () { bar (0); }