mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 12:16:08 +00:00

We previously doubled the id-expression expansion, even when the pack was expanded to empty. The previous condition for determining whether we should expand couldn't distinguish between cases where 'the expansion was previously postponed' and 'the expansion occurred but resulted in emptiness.' In the latter scenario, we crash because we have not been examining the current lambda's parent local instantiation scope since [D98068](https://reviews.llvm.org/D98068): Any Decls instantiated in the parent scope are not visible to the generic lambda, and thus any attempt of looking for instantiated Decls in the lambda is capped to the current Lambda's LIS. Fixes https://github.com/llvm/llvm-project/issues/92230
21 lines
599 B
C++
21 lines
599 B
C++
// RUN: %clang_cc1 -std=c++2c -x c++-header %s -emit-pch -o %t.pch
|
|
// RUN: %clang_cc1 -std=c++2c -x c++ /dev/null -include-pch %t.pch
|
|
|
|
// RUN: %clang_cc1 -std=c++2c -x c++-header %s -emit-pch -fpch-instantiate-templates -o %t.pch
|
|
// RUN: %clang_cc1 -std=c++2c -x c++ /dev/null -include-pch %t.pch
|
|
|
|
template <int I, typename... U>
|
|
using Type = U...[I];
|
|
|
|
template <int I, auto...V>
|
|
constexpr auto Var = V...[I];
|
|
|
|
template <int I, auto...V>
|
|
decltype(V...[I]) foo() { return V...[I]; }
|
|
|
|
void fn1() {
|
|
using A = Type<1, int, long, double>;
|
|
constexpr auto V = Var<2, 0, 1, 42>;
|
|
foo<2, 0, 1, 42>();
|
|
}
|