[clang] [clang][Interp] IndirectMember initializers (PR #69900)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 09:57:13 PST 2024


================
@@ -198,6 +198,27 @@ bool ByteCodeStmtGen<Emitter>::visitFunc(const FunctionDecl *F) {
           return false;
         if (!this->emitInitPtrPop(InitExpr))
           return false;
+      } else if (const IndirectFieldDecl *IFD = Init->getIndirectMember()) {
+        assert(IFD->getChainingSize() >= 2);
+
+        unsigned NestedFieldOffset = 0;
+        const Record::Field *NestedField = nullptr;
+        for (const NamedDecl *ND : IFD->chain()) {
+          // FIXME: Can this *not* be a FieldDecl?
----------------
tbaederr wrote:

The current interpreter uses `cast<FieldDecl>` as well, so this should be fine. Unfortunately, unions aren't handled at all in the new interpreter right now, so that could be a FIXME comment at best.

https://github.com/llvm/llvm-project/pull/69900


More information about the cfe-commits mailing list