diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-07-08 20:46:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-07-08 20:46:06 -0700 |
| commit | 7bd0500589f02a6f2ba75525d803b2c1d7409ebe (patch) | |
| tree | 63c26680b4ce918a718192ac540772e3152b9fe0 /src/analyze.cpp | |
| parent | 8e425c0c8d78acc64a4223a35010df478d5b7e16 (diff) | |
| parent | 0e1c7209e8632ebf398e60de9053e2e0fe8b5661 (diff) | |
| download | zig-7bd0500589f02a6f2ba75525d803b2c1d7409ebe.tar.gz zig-7bd0500589f02a6f2ba75525d803b2c1d7409ebe.zip | |
Merge remote-tracking branch 'origin/master' into register-allocation
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 699b121276..afe0fe6849 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -4012,6 +4012,10 @@ static void resolve_decl_var(CodeGen *g, TldVar *tld_var, bool allow_lazy) { } else if (!is_extern) { add_node_error(g, source_node, buf_sprintf("variables must be initialized")); implicit_type = g->builtin_types.entry_invalid; + } else if (explicit_type == nullptr) { + // extern variable without explicit type + add_node_error(g, source_node, buf_sprintf("unable to infer variable type")); + implicit_type = g->builtin_types.entry_invalid; } ZigType *type = explicit_type ? explicit_type : implicit_type; |
