Browse Source

Fix slicing of pointer to array

gingerBill 5 years ago
parent
commit
7140c95c55
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/check_expr.cpp

+ 1 - 1
src/check_expr.cpp

@@ -8717,7 +8717,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
 		case Type_Array:
 			valid = true;
 			max_count = t->Array.count;
-			if (o->mode != Addressing_Variable) {
+			if (o->mode != Addressing_Variable && !is_type_pointer(o->type)) {
 				gbString str = expr_to_string(node);
 				error(node, "Cannot slice array '%s', value is not addressable", str);
 				gb_string_free(str);