I believe @matklad is right here. Notice the output of the program:
const cn: isize = 42; // c1 == c2
var vn: isize = 123; // v1 != v2
@compileLog(&.{ .a = &cn, .b = &cn });
@compileLog(&.{ .a = &cn, .b = &cn });
@compileLog(&.{ .a = &vn, .b = &vn });
@compileLog(&.{ .a = &vn, .b = &vn });
@compileLog(&.{ .a = &cn, .b = &vn });
@compileLog(&.{ .a = &cn, .b = &vn });
is
literals.zig:19:5: error: found compile log statement
@compileLog(&.{ .a = &cn, .b = &cn });
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compile Log Output:
@as(*const struct{comptime a: *const isize = 42, comptime b: *const isize = 42}, .{.a = 42, .b = 42})
@as(*const struct{comptime a: *const isize = 42, comptime b: *const isize = 42}, .{.a = 42, .b = 42})
@as(*const struct{a: *isize, b: *isize}, [runtime value])
@as(*const struct{a: *isize, b: *isize}, [runtime value])
@as(*const struct{comptime a: *const isize = 42, b: *isize}, [runtime value])
@as(*const struct{comptime a: *const isize = 42, b: *isize}, [runtime value])
From what I know, comptime values are always interned. This is required from the correct semantics of things like generic functions.