[clang] [clang] Implement CWG2611 (PR #133747)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 9 10:43:55 PDT 2025
================
@@ -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
More information about the cfe-commits
mailing list