add ability to explicitly cast enum with no payload to int

This commit is contained in:
Andrew Kelley
2016-08-25 20:52:35 -07:00
parent 651dc31247
commit 6e6d138c2f
5 changed files with 44 additions and 1 deletions

View File

@@ -1062,6 +1062,8 @@ static LLVMValueRef gen_cast_expr(CodeGen *g, AstNode *node) {
case CastOpIntToEnum:
return gen_widen_or_shorten(g, node, actual_type, wanted_type->data.enumeration.tag_type, expr_val);
case CastOpEnumToInt:
return gen_widen_or_shorten(g, node, actual_type->data.enumeration.tag_type, wanted_type, expr_val);
}
zig_unreachable();
}