================
@@ -15598,6 +15598,9 @@ 
TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
     return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
                                                 E->getOperator());
 
+  if (*NumExpansions == 1)
----------------
erichkeane wrote:

This needs a comment/examples to show why this is happening.

I'm not completely familiar with this instantiation, but I have a few things to 
think about:

1- Make sure that we ONLY omit the parens in cases where this is a full 
instantiation, if we do it on partial instantiations, I think we get that wrong.

2- Make sure we do this in both left and right folds, there is some work above 
that seems to do this differently in right-fold inits.

3- Should we be doing the ignore-parens on the pattern/before instantiation, 
rather than after?  I'm trying to figure out if there is good reason why/why 
not.

4- Are there examples where this ISN'T correct we could defend against?  
Something like:

`if ( (a == 0) or ... && (b == 0) or ...)` (or something similar, where we are 
expanding two packs, and the parens might be meaningful).

Those situations aren't really concerning for us during normal compilation, but 
it could mean an AST print would get parsed differently than we mean it.

https://github.com/llvm/llvm-project/pull/110761
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to