1 // RUN: %clang_cc1 -std=c++20 -DEXPLICIT -verify %s 2 // RUN: %clang_cc1 -std=c++17 -DEXPLICIT -verify -Wno-c++20-extensions %s 3 // RUN: %clang_cc1 -std=c++14 -verify %s 4 5 // expected-no-diagnostics 6 7 #ifdef EXPLICIT 8 9 template <typename F> 10 void a(F &&f) { 11 f.template operator()<0>(); 12 } 13 14 template <typename F> 15 void b(F &&f) { 16 a([=]<int i>() { 17 f.template operator()<i>(); 18 }); 19 } 20 21 void c() { 22 b([&]<int i>() { 23 }); 24 } 25 26 #endif 27 28 template <typename F> void a1(F f) { f.operator()(0); } 29 30 template <typename F> void b1(F f) { 31 a1([=](auto i) { f.operator()(i); }); 32 } 33 34 void c1() { 35 b1([&](auto i) {}); 36 } 37 38 void c2() { 39 const auto lambda = [&](auto arg1) {}; 40 [&](auto arg2) { lambda.operator()(arg2); }(0); 41 } 42