| author | |
| committer | |
| log | e4a86d4653c5854437371e2b63006bd4a1b4c83d |
| tree | 66fcb47280ed14f33e86deb805be79f9497bc537 |
| parent | e553ade090582d7f863e2f02e6e0c803d4b9408b |
| parent | 1a2e02e267216bb35937d25598c773255d830b25 |
| signature |
fixes #23463 files changed, 20 insertions(+), 0 deletions(-)
src/ir.cpp+13| ... | @@ -188,6 +188,19 @@ static ConstExprValue *const_ptr_pointee_unchecked(CodeGen *g, ConstExprValue *c | ... | @@ -188,6 +188,19 @@ static ConstExprValue *const_ptr_pointee_unchecked(CodeGen *g, ConstExprValue *c |
| 188 | assert(get_src_ptr_type(const_val->type) != nullptr); | 188 | assert(get_src_ptr_type(const_val->type) != nullptr); |
| 189 | assert(const_val->special == ConstValSpecialStatic); | 189 | assert(const_val->special == ConstValSpecialStatic); |
| 190 | ConstExprValue *result; | 190 | ConstExprValue *result; |
| 191 | |||
| 192 | switch (type_has_one_possible_value(g, const_val->type->data.pointer.child_type)) { | ||
| 193 | case OnePossibleValueInvalid: | ||
| 194 | zig_unreachable(); | ||
| 195 | case OnePossibleValueYes: | ||
| 196 | result = create_const_vals(1); | ||
| 197 | result->type = const_val->type->data.pointer.child_type; | ||
| 198 | result->special = ConstValSpecialStatic; | ||
| 199 | return result; | ||
| 200 | case OnePossibleValueNo: | ||
| 201 | break; | ||
| 202 | } | ||
| 203 | |||
| 191 | switch (const_val->data.x_ptr.special) { | 204 | switch (const_val->data.x_ptr.special) { |
| 192 | case ConstPtrSpecialInvalid: | 205 | case ConstPtrSpecialInvalid: |
| 193 | zig_unreachable(); | 206 | zig_unreachable(); |
test/stage1/behavior.zig+1| ... | @@ -24,6 +24,7 @@ comptime { | ... | @@ -24,6 +24,7 @@ comptime { |
| 24 | _ = @import("behavior/bugs/1851.zig"); | 24 | _ = @import("behavior/bugs/1851.zig"); |
| 25 | _ = @import("behavior/bugs/1914.zig"); | 25 | _ = @import("behavior/bugs/1914.zig"); |
| 26 | _ = @import("behavior/bugs/2006.zig"); | 26 | _ = @import("behavior/bugs/2006.zig"); |
| 27 | _ = @import("behavior/bugs/2346.zig"); | ||
| 27 | _ = @import("behavior/bugs/394.zig"); | 28 | _ = @import("behavior/bugs/394.zig"); |
| 28 | _ = @import("behavior/bugs/421.zig"); | 29 | _ = @import("behavior/bugs/421.zig"); |
| 29 | _ = @import("behavior/bugs/529.zig"); | 30 | _ = @import("behavior/bugs/529.zig"); |
test/stage1/behavior/bugs/2346.zig created+6| ... | @@ -0,0 +1,6 @@ | ||
| 1 | test "" { | ||
| 2 | const a: *void = undefined; | ||
| 3 | const b: *[1]void = a; | ||
| 4 | const c: *[0]u8 = undefined; | ||
| 5 | const d: []u8 = c; | ||
| 6 | } | ||
| \ No newline at end of file | |||