[clang] [Clang] Fix dependency computation for pack indexing expression (PR #91933)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 19:47:53 PDT 2024


================
@@ -9806,7 +9806,7 @@ QualType Sema::BuildCountAttributedArrayType(QualType WrappedTy,
 /// that expression, according to the rules in C++11
 /// [dcl.type.simple]p4 and C++11 [expr.lambda.prim]p18.
 QualType Sema::getDecltypeForExpr(Expr *E) {
-  if (E->isTypeDependent())
+  if (E->isInstantiationDependent())
----------------
zyn0217 wrote:

Is it... right? I was assuming this would bring such regressions e.g.

```cpp
template <class T>
const int val = sizeof(T);

template <class T>
void foo() {
  decltype(val<T>);  // <-- this is instantiation-dependent, but not type-dependent.
}
```

Perhaps we can move it to line 9816 where the `PackIndexingExpr` is handled?

https://github.com/llvm/llvm-project/pull/91933


More information about the cfe-commits mailing list