| author | |
| committer | |
| log | aee973829d7b101d76e94d9aee15b1bef33094c0 |
| tree | 9ce52349a3124d2229a3d125c801fdc39dcdf734 |
| parent | c968d8756c9158433a9fb30db1f4989d1148cc7f |
| parent | 1357bc7430e48137b249c6930b4f03c48efa0f33 |
| signature | Commit is signed but in an unrecognized format. |
2 files changed, 16 insertions(+), 0 deletions(-)
src/analyze.cpp+7| ... | ... | @@ -5751,6 +5751,13 @@ void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_v |
| 5751 | 5751 | } |
| 5752 | 5752 | |
| 5753 | 5753 | void render_const_val_ptr(CodeGen *g, Buf *buf, ConstExprValue *const_val, ZigType *type_entry) { |
| 5754 | assert(type_entry->id == ZigTypeIdPointer); | |
| 5755 | ||
| 5756 | if (type_entry->data.pointer.child_type->id == ZigTypeIdOpaque) { | |
| 5757 | buf_append_buf(buf, &type_entry->name); | |
| 5758 | return; | |
| 5759 | } | |
| 5760 | ||
| 5754 | 5761 | switch (const_val->data.x_ptr.special) { |
| 5755 | 5762 | case ConstPtrSpecialInvalid: |
| 5756 | 5763 | zig_unreachable(); |
test/compile_errors.zig+9| ... | ... | @@ -1,6 +1,15 @@ |
| 1 | 1 | const tests = @import("tests.zig"); |
| 2 | 2 | |
| 3 | 3 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 4 | cases.add( | |
| 5 | "compile log a pointer to an opaque value", | |
| 6 | \\export fn entry() void { | |
| 7 | \\ @compileLog(@ptrCast(*const c_void, &entry)); | |
| 8 | \\} | |
| 9 | , | |
| 10 | ".tmp_source.zig:2:5: error: found compile log statement", | |
| 11 | ); | |
| 12 | ||
| 4 | 13 | cases.add( |
| 5 | 14 | "duplicate boolean switch value", |
| 6 | 15 | \\comptime { |