diff options
Diffstat (limited to 'src/move.c')
| -rw-r--r-- | src/move.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -372,6 +372,19 @@ static int mvcheck_id(struct state *state, struct ast *node) if (def->k != AST_VAR_DEF) return 0; + struct ast_pair *prev = find_move(state, def); + + /* a reference invalidation is represented as a 'moved' + * reference, which is not expressible within the + * language but is constructed as part of + * opt_group_left/opt_group_right forcing a move to + * happen. Hack? */ + if (def->t->k == TYPE_REF && prev) { + /** @todo a more fitting error message? */ + move_error(node, prev->use); + return -1; + } + if (is_trivially_copyable(def->t)) return 0; @@ -381,7 +394,6 @@ static int mvcheck_id(struct state *state, struct ast *node) return -1; } - struct ast_pair *prev = find_move(state, def); if (prev) { /* error messages for opt groups could be improved */ move_error(node, prev->use); |
