[PATCH] D146465: [clang] Fix 2 bugs with parenthesized aggregate initialization

Alan Zhao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 15:20:52 PDT 2023


ayzhao created this revision.
Herald added a project: All.
ayzhao requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- Fix an issue where temporaries initialized via parenthesized aggregate initialization don't get destroyed.
- Fix an issue where aggregate initialization omits calls to class members' move constructors after a TreeTransform. This occurs because the CXXConstructExpr wrapping the call to the move constructor gets unboxed during a TreeTransform of the wrapping FunctionalCastExpr (as with a InitListExpr), but unlike InitListExpr, we dont reperform the InitializationSequence for the list's expressions to regenerate the CXXConstructExpr. This patch fixes this bug by treating CXXParenListInitExpr identically to InitListExpr in this regard.

Fixes #61145


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146465

Files:
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/test/CodeGen/paren-list-agg-init.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146465.506753.patch
Type: text/x-patch
Size: 4961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230320/7a7132f8/attachment-0001.bin>


More information about the cfe-commits mailing list