Skip to content

Commit

Permalink
Don't call render_const_val_array() on undefined
Browse files Browse the repository at this point in the history
Fixes #10031.
  • Loading branch information
jmc-88 authored and andrewrk committed Oct 26, 2021
1 parent f2a174b commit 17e46a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/stage1/analyze.cpp
Expand Up @@ -7626,7 +7626,10 @@ void render_const_value(CodeGen *g, Buf *buf, ZigValue *const_val) {
ZigValue *array = ptr_val->data.x_ptr.data.base_array.array_val;
size_t start = ptr_val->data.x_ptr.data.base_array.elem_index;

render_const_val_array(g, buf, &type_entry->name, array, start, len);
if (array->special == ConstValSpecialUndef)
buf_append_str(buf, "undefined");
else
render_const_val_array(g, buf, &type_entry->name, array, start, len);
} else {
buf_appendf(buf, "(struct %s constant)", buf_ptr(&type_entry->name));
}
Expand Down

0 comments on commit 17e46a3

Please sign in to comment.