diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-16 21:13:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-16 21:13:10 -0400 |
| commit | 751518787ae9772eb063a4911a10bf30b2c2a19c (patch) | |
| tree | 4dd5a4613a04760571da1088648704ec3c72e353 /src/analyze.cpp | |
| parent | 3ee4d23ebdd149e734ca33904a4786d5bd3fa8aa (diff) | |
| parent | 472b7ef7e6db4bdd4717ff5b44b63e233853bb06 (diff) | |
| download | zig-751518787ae9772eb063a4911a10bf30b2c2a19c.tar.gz zig-751518787ae9772eb063a4911a10bf30b2c2a19c.zip | |
Merge pull request #1109 from ziglang/pass-by-non-copying-value
allow passing by non-copying value
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index cbeac7bc21..758bc1a045 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1135,7 +1135,10 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { gen_param_info->src_index = i; gen_param_info->gen_index = SIZE_MAX; - type_ensure_zero_bits_known(g, type_entry); + ensure_complete_type(g, type_entry); + if (type_is_invalid(type_entry)) + return g->builtin_types.entry_invalid; + if (type_has_bits(type_entry)) { TypeTableEntry *gen_type; if (handle_is_ptr(type_entry)) { @@ -1546,12 +1549,6 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c case TypeTableEntryIdUnion: case TypeTableEntryIdFn: case TypeTableEntryIdPromise: - ensure_complete_type(g, type_entry); - if (calling_convention_allows_zig_types(fn_type_id.cc) && !type_is_copyable(g, type_entry)) { - add_node_error(g, param_node->data.param_decl.type, - buf_sprintf("type '%s' is not copyable; cannot pass by value", buf_ptr(&type_entry->name))); - return g->builtin_types.entry_invalid; - } break; } FnTypeParamInfo *param_info = &fn_type_id.param_info[fn_type_id.next_param_index]; |
