[PATCH] D141690: [clang] fix consteval ctor code generation assert

Luke Nihlen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 10:21:45 PST 2023


luken-google added inline comments.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:1338
+  llvm::StructType *STy = dyn_cast<llvm::StructType>(Val->getType());
+  if (STy && STy->isLayoutIdentical(cast<llvm::StructType>(Dest.getElementType()))) {
     for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
----------------
ilya-biryukov wrote:
> Is it guaranteed that `Dest.getElementType()` is never something other than `StructType`?
Yikes, no. And checking the cast as another condition broke a bunch of other cases. This works much better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141690



More information about the cfe-commits mailing list