| author | |
| committer | |
| log | 59de23dfa010c5556f79fbb8b4c637c8d150fd88 |
| tree | 0b54e104539ef236d979d26bae14283f49ef44ea |
| parent | b169f7b0d51fa9e7cf570479079369b9736093ff |
Fixes #34332 files changed, 9 insertions(+), 1 deletions(-)
src/ir.cpp+1-1| ... | ... | @@ -17395,7 +17395,7 @@ static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, |
| 17395 | 17395 | result->value->type = get_pointer_to_type_extra(ira->codegen, var->var_type, |
| 17396 | 17396 | var->src_is_const, is_volatile, PtrLenSingle, var->align_bytes, 0, 0, false); |
| 17397 | 17397 | |
| 17398 | if (linkage_makes_it_runtime) | |
| 17398 | if (linkage_makes_it_runtime || var->is_thread_local) | |
| 17399 | 17399 | goto no_mem_slot; |
| 17400 | 17400 | |
| 17401 | 17401 | if (value_is_comptime(var->const_value)) { |
test/stage1/behavior/misc.zig+8| ... | ... | @@ -773,3 +773,11 @@ test "result location is optional inside error union" { |
| 773 | 773 | const x = maybe(true) catch unreachable; |
| 774 | 774 | expect(x.? == 42); |
| 775 | 775 | } |
| 776 | ||
| 777 | threadlocal var buffer: [11]u8 = undefined; | |
| 778 | ||
| 779 | test "pointer to thread local array" { | |
| 780 | const s = "Hello world"; | |
| 781 | std.mem.copy(u8, buffer[0..], s); | |
| 782 | std.testing.expectEqualSlices(u8, buffer[0..], s); | |
| 783 | } |