From 05cdcb6a1cc3d4de3a0b3d12d4babcd6438b4754 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 13:45:03 +0000 Subject: Add record-derived classes with explicit field visibility Co-Authored-By: Claude Fable 5.1 --- lib/CodeGen/Designator.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/CodeGen/Designator.cc') diff --git a/lib/CodeGen/Designator.cc b/lib/CodeGen/Designator.cc index 640ca0b..9d14d23 100644 --- a/lib/CodeGen/Designator.cc +++ b/lib/CodeGen/Designator.cc @@ -145,6 +145,11 @@ bool CodeGen::emitLValue(ExprAST *E, LValueInfo &Out) { reportError("Record type %s has no field %s", TypeName.c_str(), A.FieldName.c_str()); return false; } + if (!FI->IsPublic) { + reportError("Cannot access private field %s of type %s", + A.FieldName.c_str(), TypeName.c_str()); + return false; + } Addr = Builder->CreateStructGEP(Cur->LLVMType, Addr, FI->Index, TypeName + "." + A.FieldName); TypeName = FI->TypeName; -- cgit v1.3.1-4-g156e