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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 15:42:40 PDT 2023


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:1582-1596
+  MultiExprArg ExprsToPass;
+  if (Exprs.size() == 1 && isa<CXXParenListInitExpr>(Exprs[0])) {
+    // C++20 [expr.static.cast]p4:
+    //   An expression E can be explicitly converted to a type T...if T is an
+    //   aggregate type ([dcl.init.aggr]) having a first element x and there is
+    //   an implicit conversion sequence from E to the type of x
+    //
----------------
The input to this function should be a syntactic initializer such as a `ParenListExpr`, not an already-type-checked semantic initializer such as a `CXXParenListInitExpr`. The right place to do this unwrapping is in `TreeTransform::TransformInitializer`, where we unwrap various other kinds of semantic initializer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146465



More information about the cfe-commits mailing list