-
-
Save anonymous/527e90e07b203eacd0b63f6be2412507 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Point = struct { value: u32 }; | |
const TypeInfo = struct { t: type }; | |
fn get_type_info(comptime T: type) (comptime TypeInfo) | |
{ | |
return TypeInfo{ .t = T }; | |
} | |
pub fn main() void | |
{ | |
comptime const info_t = TypeInfo{ .t = Point }; // Works | |
comptime const info = get_type_info(Point); // error: cannot store runtime value in compile time variable | |
@compileLog(info); | |
const v = info.self_type { .value = 11 }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment