aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-23 00:53:43 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-23 00:53:43 -0700
commit91d911007b8a12405c084cff53237ac26b1f2c5f (patch)
tree1571ed6ef821bd664a35b854c946fa9f67f332a9 /src/codegen.cpp
parenta922d5d42a3ba9bbded0740e1eb3246e7b57ad2a (diff)
downloadzig-91d911007b8a12405c084cff53237ac26b1f2c5f.tar.gz
zig-91d911007b8a12405c084cff53237ac26b1f2c5f.zip
codegen: fix field access of arrays
also fix error type analyze error
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index e81437c66a..e2629a44e6 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -27,6 +27,7 @@ CodeGen *codegen_create(Buf *root_source_dir) {
g->build_type = CodeGenBuildTypeDebug;
g->root_source_dir = root_source_dir;
g->next_error_index = 1;
+ g->error_value_count = 1;
return g;
}
@@ -684,7 +685,7 @@ static LLVMValueRef gen_field_access_expr(CodeGen *g, AstNode *node, bool is_lva
{
TypeTableEntry *type_entry;
LLVMValueRef ptr = gen_field_ptr(g, node, &type_entry);
- if (is_lvalue) {
+ if (is_lvalue || handle_is_ptr(type_entry)) {
return ptr;
} else {
add_debug_source_node(g, node);