llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: cor3ntin (cor3ntin) <details> <summary>Changes</summary> Given `foo...[idx]` if idx is value dependent, the expression is type dependent. Fixes #<!-- -->91885 Fixes #<!-- -->91884 --- Full diff: https://github.com/llvm/llvm-project/pull/91933.diff 2 Files Affected: - (modified) clang/lib/AST/ComputeDependence.cpp (+3) - (modified) clang/test/SemaCXX/cxx2c-pack-indexing.cpp (+14) ``````````diff diff --git a/clang/lib/AST/ComputeDependence.cpp b/clang/lib/AST/ComputeDependence.cpp index bad8e75b2f878..ee56c50d76512 100644 --- a/clang/lib/AST/ComputeDependence.cpp +++ b/clang/lib/AST/ComputeDependence.cpp @@ -376,6 +376,9 @@ ExprDependence clang::computeDependence(PackExpansionExpr *E) { ExprDependence clang::computeDependence(PackIndexingExpr *E) { ExprDependence D = E->getIndexExpr()->getDependence(); + if (D & ExprDependence::Value) + D |= ExprDependence::TypeInstantiation; + ArrayRef<Expr *> Exprs = E->getExpressions(); if (Exprs.empty()) D |= (E->getPackIdExpression()->getDependence() | diff --git a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp index a3e5a0931491b..764f6163710bd 100644 --- a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp +++ b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp @@ -194,3 +194,17 @@ void h() { // expected-note-re@-2 {{function template specialization '{{.*}}' requested here}} } } + +namespace GH91885 { + +void test(auto...args){ + [&]<int idx>(){ + using R = decltype( args...[idx] ) ; + }.template operator()<0>(); +} + +void f( ) { + test(1); +} + +} `````````` </details> https://github.com/llvm/llvm-project/pull/91933 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits