================
@@ -16441,14 +16441,23 @@ 
TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
       return true;
   }
 
-  if (ParenExpr *PE = dyn_cast_or_null<ParenExpr>(Result.get()))
-    PE->setIsProducedByFoldExpansion();
-
   // If we had no init and an empty pack, and we're not retaining an expansion,
   // then produce a fallback value or error.
   if (Result.isUnset())
     return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
                                                 E->getOperator());
+
+  // Wrap the result in a ParenExpr if it isn't already one (see CWG2611).
+  ParenExpr *PE = dyn_cast<ParenExpr>(Result.get());
+  if (!PE) {
+    Result = getDerived().RebuildParenExpr(Result.get(), E->getLParenLoc(),
----------------
offsetof wrote:

Thanks; updated.

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

Reply via email to