Comptime unique IDs

here’s a self-contained example:

const std = @import("std");
const print = std.log.info;

const CA = struct {
    s: *S,
};

const CB = struct {
    s: *S,
    s2: *S2,
};

const S = struct {
    x: u32 = 10,
};

const S2 = struct {
    y: u32 = 5,
};

fn create(T: type, key: anytype) *T {
    return &struct {
        var o = blk: {
            std.mem.doNotOptimizeAway(key);
            break :blk std.mem.zeroInit(T, .{});
        };
    }.o;
}

fn initC(CT: type) CT {
    comptime {
        var new_c: CT = undefined;
        const cti = @typeInfo(CT);
        for (cti.Struct.fields) |fld| {
            const fti = @typeInfo(fld.type);
            const FT = fti.Pointer.child;
            const fval = create(FT, opaque {});
            @field(new_c, fld.name) = fval;
        }
        const res = new_c;
        return res;
    }
}

const ca = initC(CA);
const cb = initC(CB);

pub fn main() void {
    ca.s.x = 20;
    print("ca.s.x = {d}", .{ca.s.x});
    print("cb.s.x = {d}", .{cb.s.x});
    print("cb.2.y = {d}", .{cb.s2.y});
}

and the output is:

info: ca.s.x = 20
info: cb.s.x = 20
info: cb.s2.y = 5

clearly CA and CB are distinct types with different fields… but the create function used to instantiate values for fields of type *S and *S2 (suggested by @AndrewCodeDev in this post) doesn’t appear to yield a distinct instance of the s: *S field in CA and CB

how can ensure that my modification of cb.s.x doesn’t ALSO clobber ca.s.x???