PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / lambda-generic-ice5.C
blob473e412cb9d498af52d7e268c458075975a78d50
1 // PR c++/78337
2 // { dg-do compile { target c++14 } }
4 struct X {
5   static constexpr int foo (int b) {
6     return b;
7   }
8 };
10 template<int>
11 using Void = void;
13 template<typename F,typename A>
14 auto
15 bar(F f, A a) -> decltype( ( f(a) , 0 ) ) // { dg-error "no match" }
16 { return {}; }
19 int main() {
20   //constexpr
21   int f = 3;
22   (void)f;
23   auto l = [](auto of_type_X)->
24     Void<(decltype(of_type_X)::foo(f), 0)> // { dg-error "variable" }
25     {return;};
26   bar(l , X{});                 // { dg-error "no match" }