fix comptime modification of const struct field

This commit is contained in:
Andrew Kelley
2019-06-19 14:35:59 -04:00
parent 79671efd3a
commit b588a803bf
6 changed files with 41 additions and 27 deletions

View File

@@ -4711,7 +4711,7 @@ ReqCompTime type_requires_comptime(CodeGen *g, ZigType *type_entry) {
void init_const_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *str) {
auto entry = g->string_literals_table.maybe_get(str);
if (entry != nullptr) {
*const_val = *entry->value;
memcpy(const_val, entry->value, sizeof(ConstExprValue));
return;
}