diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-11-24 16:15:58 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-11-24 16:15:58 -0500 |
| commit | 3d2752cc3677535ddfbeeefba4036633bcab01dc (patch) | |
| tree | 461cb6fc9eaf9ccbc8e6c8ea5207a380ecbcca2b /src/codegen.cpp | |
| parent | 56a8f2b018a6ee1f1116a64d34803511a6fbad80 (diff) | |
| download | zig-3d2752cc3677535ddfbeeefba4036633bcab01dc.tar.gz zig-3d2752cc3677535ddfbeeefba4036633bcab01dc.zip | |
refactor type_requires_comptime to have possible error
fixes a compiler crash when building
https://github.com/AndreaOrru/zen
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 096552037d..37e0424961 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -6281,8 +6281,14 @@ static void do_code_gen(CodeGen *g) { } if (ir_get_var_is_comptime(var)) continue; - if (type_requires_comptime(var->value->type)) - continue; + switch (type_requires_comptime(g, var->value->type)) { + case ReqCompTimeInvalid: + zig_unreachable(); + case ReqCompTimeYes: + continue; + case ReqCompTimeNo: + break; + } if (var->src_arg_index == SIZE_MAX) { var->value_ref = build_alloca(g, var->value->type, buf_ptr(&var->name), var->align_bytes); |
