From f7e9d7aa5d115a6a8158625cd1aceb7e8dafe880 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 7 Apr 2017 15:34:13 -0400 Subject: ability to implicitly cast integer literal to &const Int where Int is an integer type also introduce `@intToPtr` builtin for converting a usize to a pointer. users now have to use this instead of `(&T)(int)`. closes #311 --- src/codegen.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 8bc204caea..edd2cd181e 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -4326,6 +4326,7 @@ static void define_builtin_fns(CodeGen *g) { create_builtin_fn(g, BuiltinFnIdSetGlobalLinkage, "setGlobalLinkage", 2); create_builtin_fn(g, BuiltinFnIdPanic, "panic", 1); create_builtin_fn(g, BuiltinFnIdPtrCast, "ptrcast", 2); + create_builtin_fn(g, BuiltinFnIdIntToPtr, "intToPtr", 2); } static void add_compile_var(CodeGen *g, const char *name, ConstExprValue *value) { -- cgit v1.2.3