aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-19 01:53:14 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-19 01:53:14 -0500
commit2f8dd46174821a12205f939cda51f0fb4765475f (patch)
tree081d54c71464abc69f238540d4d25df2b53af0d4 /src/analyze.cpp
parent8a81f8aa1388331624e4c073e2534d3a987a7d9a (diff)
downloadzig-2f8dd46174821a12205f939cda51f0fb4765475f.tar.gz
zig-2f8dd46174821a12205f939cda51f0fb4765475f.zip
IR: error for uncasted null lit variable
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 8daedbd4d2..bbd9fd68a6 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -1939,6 +1939,9 @@ static void resolve_var_decl(CodeGen *g, ImportTableEntry *import, AstNode *node
{
add_node_error(g, node, buf_sprintf("unable to infer variable type"));
implicit_type = g->builtin_types.entry_invalid;
+ } else if (implicit_type->id == TypeTableEntryIdNullLit) {
+ add_node_error(g, node, buf_sprintf("unable to infer variable type"));
+ implicit_type = g->builtin_types.entry_invalid;
} else if (implicit_type->id == TypeTableEntryIdMetaType && !is_const) {
add_node_error(g, node, buf_sprintf("variable of type 'type' must be constant"));
implicit_type = g->builtin_types.entry_invalid;