[clang] [Sema] Avoid an undesired pack expansion while transforming PackIndexingType (PR #90195)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 27 23:03:42 PDT 2024
================
@@ -160,3 +160,22 @@ namespace GH88929 {
using E = P...[0]; // expected-error {{unknown type name 'P'}} \
// expected-error {{expected ';' after alias declaration}}
}
+
+namespace GH88925 {
+template <typename...> struct S {};
+
+template <int...> struct sequence {};
+
+template <typename... Args, int... indices> auto f(sequence<indices...>) {
+ return S<Args...[indices]...>(); // #use
+}
+
----------------
zyn0217 wrote:
I realized those expressions could be PRValues after an instantiation because in `PackIndexingExpr` we have:
```cpp
if (!isInstantiationDependent())
setValueKind(getSelectedExpr()->getValueKind());
```
So, I'm going to make it always an LValue iff it's dependent.
https://github.com/llvm/llvm-project/pull/90195
More information about the cfe-commits
mailing list