forked from OSchip/llvm-project
42 lines
708 B
C++
42 lines
708 B
C++
// RUN: %clang_cc1 -std=c++20 -DEXPLICIT -verify %s
|
|
// RUN: %clang_cc1 -std=c++17 -DEXPLICIT -verify -Wno-c++20-extensions %s
|
|
// RUN: %clang_cc1 -std=c++14 -verify %s
|
|
|
|
// expected-no-diagnostics
|
|
|
|
#ifdef EXPLICIT
|
|
|
|
template <typename F>
|
|
void a(F &&f) {
|
|
f.template operator()<0>();
|
|
}
|
|
|
|
template <typename F>
|
|
void b(F &&f) {
|
|
a([=]<int i>() {
|
|
f.template operator()<i>();
|
|
});
|
|
}
|
|
|
|
void c() {
|
|
b([&]<int i>() {
|
|
});
|
|
}
|
|
|
|
#endif
|
|
|
|
template <typename F> void a1(F f) { f.operator()(0); }
|
|
|
|
template <typename F> void b1(F f) {
|
|
a1([=](auto i) { f.operator()(i); });
|
|
}
|
|
|
|
void c1() {
|
|
b1([&](auto i) {});
|
|
}
|
|
|
|
void c2() {
|
|
const auto lambda = [&](auto arg1) {};
|
|
[&](auto arg2) { lambda.operator()(arg2); }(0);
|
|
}
|