Debian Codegraph @

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

raw
1 // PR c++/82643
2 // { dg-do compile { target c++14 } }
3
4 int main()
5 {
6 struct A {
7 constexpr int operator()() const { return 42; }
8 };
9
10 auto f = A();
11 constexpr auto x = f(); //ok, call constexpr const non-static method
12
13 [](auto const &f) {
14 constexpr auto x = f();
15 }(f);
16
17 [&]() {
18 constexpr auto x = f(); //ko, __closure is not a constant expression
19 };
20
21 [=]() {
22 constexpr auto x = f(); //same ko, __closure is not a constant expression
23 };
24 }