[PATCH] D129531: [clang][C++20] P0960R3: Allow initializing aggregates from a parenthesized list of values

Alan Zhao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 15:58:46 PDT 2022


ayzhao added inline comments.


================
Comment at: clang/lib/Serialization/ASTReaderStmt.cpp:2179
+  for (unsigned I = 0; I < E->NumExprs; I++)
+    E->getTrailingObjects<Expr *>()[I] = Record.readSubExpr();
+}
----------------
ilya-biryukov wrote:
> FYI: I think this is where the crash comes from.
> We should allocate the trailing objects first.
> E.g. see how `PragmaCommentDecl::CreateDeserialized` does this.
This sounds like it could be the solution - thanks for looking at it!

Currently, I'm working on the refactor that shafik@ suggested, which was to inherit from `InitListExpr`. Hopefully, that refactor will fix this issue as `InitListExpr` stores it's subexpressions in a class member instead of using `llvm::TrailingObjects`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129531/new/

https://reviews.llvm.org/D129531



More information about the cfe-commits mailing list