Mercurial > vim
diff src/vim9compile.c @ 21811:3261e28c638a v8.2.1455
patch 8.2.1455: Vim9: crash when using typecast before constant
Commit: https://github.com/vim/vim/commit/d1103587cf339feb8c77d282f7f7e92b7cff5add
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 14 22:44:25 2020 +0200
patch 8.2.1455: Vim9: crash when using typecast before constant
Problem: Vim9: crash when using typecast before constant.
Solution: Generate constant before checking type. Add tets.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 14 Aug 2020 22:45:03 +0200 |
parents | 15ed135796fd |
children | 0deb6f96a5a3 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3501,11 +3501,12 @@ compile_expr7t(char_u **arg, cctx_T *cct if (want_type != NULL) { garray_T *stack = &cctx->ctx_type_stack; - type_T *actual = ((type_T **)stack->ga_data)[stack->ga_len - 1]; - + type_T *actual; + + generate_ppconst(cctx, ppconst); + actual = ((type_T **)stack->ga_data)[stack->ga_len - 1]; if (check_type(want_type, actual, FALSE) == FAIL) { - generate_ppconst(cctx, ppconst); if (need_type(actual, want_type, -1, cctx, FALSE) == FAIL) return FAIL; } @@ -5016,6 +5017,7 @@ compile_assignment(char_u *arg, exarg_T goto theend; if (*skipwhite(p) != ']') { + // this should not happen emsg(_(e_missbrac)); goto theend; }