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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 07:07:15 PST 2023


ilya-biryukov added inline comments.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:1338
+  llvm::StructType *STy = dyn_cast<llvm::StructType>(Val->getType());
+  if (STy && STy->canLosslesslyBitCastTo(Dest.getElementType())) {
     for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
----------------
Intuitively, I feel like `canLosslesslyBitCastTo` should be used in conjuction with something like `Builder.CreateBitcast` and after a quick skim through existing I can't find any uses with `CreateStore` in the codebase. This leads me to think that we need to call a different function here. As mentioned earlier, I may be completely wrong as I don't have much experience with codegen.

I will let @jyknight sanity-check my intuition.


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