Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/lambda-generic-const4.C

raw
1 // PR c++/81525
2 // { dg-do run { target c++14 } }
3
4 template <int i> struct A {
5 constexpr operator int () const { return i; }
6 };
7 template <int i> constexpr A<i> a = {};
8
9 template <typename F> void foo (F f) {
10 f (A<0>{});
11 }
12 template <typename T>
13 void bar (T) {
14 constexpr auto N = a<1>;
15 auto f = [&] (auto i) {
16 if (static_cast<int>(N) != 1) __builtin_abort();
17 };
18 foo (f);
19 }
20 int main () { bar (0); }