Advertisement
Guest User

Untitled

a guest
Jul 10th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. pub a: @typeOf(@This()),
  2. b : make_type(),
  3.  
  4. const Self = @This();
  5.  
  6. fn ret_b(comptime self: *const type) type {
  7.     var foo = @ptrCast(*const Self, self);
  8.     return foo.b;
  9. }
  10.  
  11. fn make_type() type {
  12.     const self = @This();
  13.     const std = @import("std");
  14.  
  15.     const x = std.mem.eql(u8, ret_b(&self).ret_b(), "main");
  16.  
  17.     std.debug.assert(x);
  18.    
  19.     return bool;
  20. }
  21.  
  22. test "" {
  23.     const std = @import("std");
  24.     const s = @This(){ .a = std };
  25.     s.x;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement