================ @@ -0,0 +1,181 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s + +namespace GH85667 { + +template <class T> +struct identity { + using type = T; +}; + +template <class = void> void f() { + + static_assert([]<class... Is>(Is... x) { + return ([I(x)] { + return I; + }() + ...); + }(1, 2) == 3); + + []<class... Is>(Is... x) { + return ([](auto y = Is()) { return y + 1; }() + ...); // expected-error {{no matching function}} \ + // expected-note {{couldn't infer template argument 'y:auto'}} \ + // expected-note@-1 {{requested here}} + // expected-note@#instantiate-f {{requested here}} + }(1); + + []<class... Is>() { + ([]<class = Is>(Is) + noexcept(bool(Is())) + {}(Is()), + ...); + }.template operator()<char, int, float>(); + + static_assert(__is_same(decltype([]<class... Is>() { + return ([]() -> decltype(Is()) { return {}; }(), + ...); + }.template operator()<int, char>()), + char)); + + []<class... Is>() { + return ([]<class... Ts>() -> decltype(Is()) { return Ts(); }() + ...); + // expected-error@-1 {{unexpanded parameter pack 'Ts'}} + }.template operator()<int, int>(); + + // https://github.com/llvm/llvm-project/issues/56852 + []<class... Is>(Is...) { + ([] { + using T = identity<Is>::type; + }(), ...); + }(1, 2); + + [](auto ...y) { + ([y] { }(), ...); + }(); + + [](auto ...x) { + ([&](auto ...y) { + ([x..., y] { }(), ...); + })(1); + }(2, 'b'); + +#if 0 + // https://github.com/llvm/llvm-project/issues/18873 ---------------- cor3ntin wrote:
```suggestion // FIXME: https://github.com/llvm/llvm-project/issues/18873 ``` https://github.com/llvm/llvm-project/pull/86265 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits