aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-18 11:12:15 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-18 11:12:15 -0400
commit8fd7cc11e167c0b23892d6f22841bb6856d0f499 (patch)
tree75b306d787fbbafb07ec840ef20cff1fe954e087 /src/ir.cpp
parentd49d6f0cde782f4ec3c1d623d58644c3e51a6ce9 (diff)
downloadzig-8fd7cc11e167c0b23892d6f22841bb6856d0f499.tar.gz
zig-8fd7cc11e167c0b23892d6f22841bb6856d0f499.zip
disallow opaque as a return type of fn type syntax
closes #1115
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index a312b501ab..c75a3ae7c1 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -18676,6 +18676,11 @@ static TypeTableEntry *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruc
fn_type_id.return_type = ir_resolve_type(ira, return_type_value);
if (type_is_invalid(fn_type_id.return_type))
return ira->codegen->builtin_types.entry_invalid;
+ if (fn_type_id.return_type->id == TypeTableEntryIdOpaque) {
+ ir_add_error(ira, instruction->return_type,
+ buf_sprintf("return type cannot be opaque"));
+ return ira->codegen->builtin_types.entry_invalid;
+ }
if (fn_type_id.cc == CallingConventionAsync) {
if (instruction->async_allocator_type_value == nullptr) {