================ @@ -91,15 +91,60 @@ void bar() { namespace GH82104 { -template <typename, typename...> int Zero = 0; +template <typename, typename... D> int Value = sizeof...(D); -template <typename T, typename...U> -using T14 = decltype([]<int V = 0>() { return Zero<T, U...>; }()); +template <typename T, typename... U> +using T14 = decltype([]<int V = 0>(auto Param) { + return Value<T, U...> + V + (int)sizeof(Param); +}("hello")); template <typename T> using T15 = T14<T, T>; static_assert(__is_same(T15<char>, int)); +// FIXME: This still crashes because we can't extract template arguments T and U +// outside of the instantiation context of T16. +#if 0 +template <typename T, typename... U> +using T16 = decltype([](auto Param) requires (sizeof(Param) != 1 && sizeof...(U) > 0) { + return Value<T, U...> + sizeof(Param); +}); +static_assert(T16<int, char, float>()(42) == 2 + sizeof(42)); +#endif ---------------- cor3ntin wrote:
Maybe, or something along those lines. (Or maybe we need to push some sort of state when parsing / transforming an alias and have a more generic way to get at template parameter) https://github.com/llvm/llvm-project/pull/89934 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits