aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-14 23:09:12 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-14 23:09:31 -0500
commitd6e0d82c328b4f9d733364382cce0941a601e91a (patch)
treeba5848ece64d705fa436fa4924b8e59a1a9a3dce /src/ir.cpp
parentd5bbd748711abc82272199869cf70faf1ea30f52 (diff)
downloadzig-d6e0d82c328b4f9d733364382cce0941a601e91a.tar.gz
zig-d6e0d82c328b4f9d733364382cce0941a601e91a.zip
translate-c: back to *c_void for opaque types
See #1059
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 7c46b21717..707eac0181 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -21205,10 +21205,15 @@ static IrInstruction *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstruct
} else if (child_type->id == ZigTypeIdOpaque && instruction->ptr_len == PtrLenUnknown) {
ir_add_error(ira, &instruction->base, buf_sprintf("unknown-length pointer to opaque"));
return ira->codegen->invalid_instruction;
- } else if (instruction->ptr_len == PtrLenC && !type_allowed_in_extern(ira->codegen, child_type)) {
- ir_add_error(ira, &instruction->base,
- buf_sprintf("C pointers cannot point to non-C-ABI-compatible type '%s'", buf_ptr(&child_type->name)));
- return ira->codegen->invalid_instruction;
+ } else if (instruction->ptr_len == PtrLenC) {
+ if (!type_allowed_in_extern(ira->codegen, child_type)) {
+ ir_add_error(ira, &instruction->base,
+ buf_sprintf("C pointers cannot point to non-C-ABI-compatible type '%s'", buf_ptr(&child_type->name)));
+ return ira->codegen->invalid_instruction;
+ } else if (child_type->id == ZigTypeIdOpaque) {
+ ir_add_error(ira, &instruction->base, buf_sprintf("C pointers cannot point opaque types"));
+ return ira->codegen->invalid_instruction;
+ }
}
uint32_t align_bytes;