================
@@ -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:

oh now I see what you're asking about what I found is that for something like
```cpp
template <typename... T>
void f(T... values) {
  ((void)(values ?: 0), ...);
}
```
clang will create an OpaqueValueExpr pointing to the values and since values 
will have the unexpanded flag to the opaque value the assertion will trigger.

The expansion of the pack is done later after the surrounding outer section is 
built. So basically the expansion is done later but the assertion is checked 
before the expansion so I am trying to ignore the copy of the flag to the 
OpaqueValueExpr because the outer (... , ...) fold construction will do the 
expansion.

Basically what I mean to say is that the inner `values ?:0` is constructed 
first then the cast would happen and then it would construct the (... , ...) 
and then when template init would happen then the expansion will take place.

https://github.com/llvm/llvm-project/pull/237969
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to