diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-07-09 10:43:29 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-07-09 10:44:06 -0400 |
| commit | 9eb51e20ed1a040a617541303db760f80ffd3aa1 (patch) | |
| tree | a85f682a1d27f889d1c106188c2e2406c1026f2a /src/ir.cpp | |
| parent | 42ba06133aec995feec3ea24ee7fbbc40d7ac2ca (diff) | |
| download | zig-9eb51e20ed1a040a617541303db760f80ffd3aa1.tar.gz zig-9eb51e20ed1a040a617541303db760f80ffd3aa1.zip | |
fix crash on @ptrToInt of a *void
closes #1192
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 98b1bd85ad..5e4c847e14 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -19796,6 +19796,12 @@ static TypeTableEntry *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstr return ira->codegen->builtin_types.entry_invalid; } + if (!type_has_bits(target->value.type)) { + ir_add_error(ira, target, + buf_sprintf("pointer to size 0 type has no address")); + return ira->codegen->builtin_types.entry_invalid; + } + if (instr_is_comptime(target)) { ConstExprValue *val = ir_resolve_const(ira, target, UndefBad); if (!val) |
