From 6e6d138c2f50f95fe9c6b4acbc16ffa17475a4a5 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 25 Aug 2016 20:52:35 -0700 Subject: add ability to explicitly cast enum with no payload to int --- src/codegen.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 82f7084159..bf13ba3036 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -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(); } -- cgit v1.2.3