Expected type '*T', found '*const T' in tagged union switch

I fixed out how to do this. Thank you everyone for your help. I needed to switch on the pointer like this

    pub fn read_byte(self: *const Self, address: u16) u8 {
        switch (self.*) { <-- this was the missing part
            .rom => |rom| return rom.read_byte(address),
            .mbc1 => |mbc1| return mbc1.read_byte(address),
            .mbc2 => |mbc2| return mbc2.read_byte(address),
            .mbc3 => |mbc3| return mbc3.read_byte(address),
            .mbc5 => |mbc5| return mbc5.read_byte(address),
        }
    }
1 Like