commit 19ad78d713081e422bd6e70c05837ba9034a49a4
parent 6ccf1500396efffeb38ed54ac78d2f2d41a9b762
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 6 Feb 2014 17:55:30 -0200
C++ needs casts for arithmetic with enums
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lcode.c b/lcode.c
@@ -1,5 +1,5 @@
/*
-** $Id: lcode.c,v 2.77 2013/12/30 20:47:58 roberto Exp roberto $
+** $Id: lcode.c,v 2.78 2014/01/27 13:34:32 roberto Exp $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -836,7 +836,7 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
e2.t = e2.f = NO_JUMP; e2.k = VKINT; e2.u.ival = 0;
switch (op) {
case OPR_MINUS: case OPR_BNOT: case OPR_LEN: {
- codearith(fs, op - OPR_MINUS + OP_UNM, e, &e2, line);
+ codearith(fs, cast(OpCode, (op - OPR_MINUS) + OP_UNM), e, &e2, line);
break;
}
case OPR_NOT: codenot(fs, e); break;
@@ -910,7 +910,7 @@ void luaK_posfix (FuncState *fs, BinOpr op,
case OPR_IDIV: case OPR_MOD: case OPR_POW:
case OPR_BAND: case OPR_BOR: case OPR_BXOR:
case OPR_SHL: case OPR_SHR: {
- codearith(fs, cast(OpCode, op - OPR_ADD + OP_ADD), e1, e2, line);
+ codearith(fs, cast(OpCode, (op - OPR_ADD) + OP_ADD), e1, e2, line);
break;
}
case OPR_EQ: case OPR_LT: case OPR_LE: {