[clang] [Clang] Fix crashes in coroutine pack expansions (PR #237969)

Kunal Dubey via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 08:48:25 PST 2026


================
@@ -27,8 +27,10 @@ ExprDependence clang::computeDependence(FullExpr *E) {
 
 ExprDependence clang::computeDependence(OpaqueValueExpr *E) {
   auto D = toExprDependenceForImpliedType(E->getType()->getDependence());
+  // An OpaqueValueExpr has no syntactic children, so it does not contain an
+  // unexpanded pack even if its source does.
   if (auto *S = E->getSourceExpr())
-    D |= S->getDependence();
+    D |= S->getDependence() & ~ExprDependence::UnexpandedPack;
   assert(!(D & ExprDependence::UnexpandedPack));
----------------
xakep8 wrote:

My intention was OpaqueValueExpr to inherit only the semantic dependence of its source, since the source is not one of its own AST children. The surrounding expression still contains the actual source and tracks the unexpanded pack.

I agree that explicitly masking the flag makes this look like it is bypassing the assertion. Would expressing the intent as `D |= Dependence(S->getDependence()).semantic().expr();` be clearer?

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


More information about the cfe-commits mailing list