tbaederr wrote:

Here's a quick patch with the cast inserted: 

```diff
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp 
b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 731153a6ead9..e7fa1a62c277 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1346,13 +1346,30 @@ bool 
ByteCodeExprGen<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
       }
     }

-    auto Eval = [&](Expr *Init, unsigned ElemIndex) {
-      return visitArrayElemInit(ElemIndex, Init);
-    };
-
+    E->dump();
     unsigned ElementIndex = 0;
     for (const Expr *Init : Inits) {
-      if (auto *EmbedS = dyn_cast<EmbedExpr>(Init->IgnoreParenImpCasts())) {
+      if (const auto *EmbedS = 
dyn_cast<EmbedExpr>(Init->IgnoreParenImpCasts())) {
+        QualType TargetType = Init->getType();
+        PrimType TargetT = classifyPrim(Init->getType());
+        TargetType->dump();
+
+
+    auto Eval = [&](const Expr *Init, unsigned ElemIndex) {
+      PrimType InitT = classifyPrim(Init->getType());
+      if (!this->visit(Init))
+        return false;
+      if (InitT != TargetT) {
+        if (!this->emitCast(InitT, TargetT, E))
+          return false;
+      }
+    return this->emitInitElem(TargetT, ElemIndex, Init);
+    };
+
+
+
+
+
         if (!EmbedS->doForEachDataElement(Eval, ElementIndex))
           return false;
       } else {
```

Can you check if that fixes the problem?

https://github.com/llvm/llvm-project/pull/95802
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to