aboutsummaryrefslogtreecommitdiff
path: root/src/move.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/move.c b/src/move.c
index 9a89f75..7f54427 100644
--- a/src/move.c
+++ b/src/move.c
@@ -175,6 +175,13 @@ static int mvcheck_ref(struct state *state, struct ast *node)
return refcheck(state, ref_base(node));
}
+static int mvcheck_deref(struct state *state, struct ast *node)
+{
+ /** @todo good enough for now but probably won't hold when we start
+ * doing element lookups in structs etc. */
+ return mvcheck(state, deref_base(node));
+}
+
static int mvcheck_proc(struct state *state, struct ast *node)
{
/* extern, can't really do anything so just say it's fine */
@@ -271,6 +278,9 @@ static int mvcheck_id(struct state *state, struct ast *node)
if (def->k != AST_VAR_DEF)
return 0;
+ if (is_trivially_copyable(def->t))
+ return 0;
+
if (in_pure(state)) {
semantic_error(node->scope, node,
"move in pure context not allowed");
@@ -409,6 +419,7 @@ static int mvcheck(struct state *state, struct ast *node)
case AST_INIT: return mvcheck_init (state, node);
case AST_IF: return mvcheck_if (state, node);
case AST_REF: return mvcheck_ref (state, node);
+ case AST_DEREF: return mvcheck_deref (state, node);
case AST_EMPTY:
case AST_CONST_INT:
case AST_CONST_STR: