Debian Codegraph @

clang/test/SemaCXX/lambdas-implicit-explicit-template.cpp

raw
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
43 auto d = [](auto) {};
44
45 template <typename T>
46 void d1(T x) { d.operator()(x); }
47
48 void d2() { d1(0); }
49
50 template <typename T> int e1 = [](auto){ return T(); }.operator()(T());
51 int e2 = e1<int>;