aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-11-20 16:01:59 +0000
committergingerBill <bill@gingerbill.org>2020-11-20 16:01:59 +0000
commit6416a6f39cce4c65c80e29bb4ff4b93a3e463947 (patch)
tree2bf6668068ab0516998fb6bde144a3d4a69bac9e /src/check_expr.cpp
parent87956676f52a56db98e263d1074b490b71141f0b (diff)
Allow string literals for `[N]byte`
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index aa3d67dae..f258253f5 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -2955,6 +2955,12 @@ void convert_to_typed(CheckerContext *c, Operand *operand, Type *target_type) {
if (check_is_assignable_to(c, operand, elem)) {
operand->mode = Addressing_Value;
} else {
+ if (operand->value.kind == ExactValue_String && is_type_u8_array(t)) {
+ String s = operand->value.value_string;
+ if (s.len == t->Array.count) {
+ break;
+ }
+ }
operand->mode = Addressing_Invalid;
convert_untyped_error(c, operand, target_type);
return;