diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-10-28 22:30:31 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-10-28 22:30:31 +0800 |
commit | 2ad506b0f4639f5f00909ed92cba7873aaf0951b (patch) | |
tree | ed1056be79499090fbffd846031cdeba99128aa8 | |
parent | e7b1057eb9d96928a3da269902848da357ede1eb (diff) | |
download | mrust-2ad506b0f4639f5f00909ed92cba7873aaf0951b.tar.gz |
HIR Typecheck - Allow casting function pointers
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 63383aa5..ea040bf0 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -2190,7 +2190,10 @@ namespace { ), (Function, // Check that the ABI and unsafety is correct - ERROR(sp, E0000, "Non-scalar cast to " << this->context.m_ivars.fmt_type(tgt_ty) << " to " << this->context.m_ivars.fmt_type(src_ty)); + if( s_e.m_abi != e.m_abi || s_e.is_unsafe != e.is_unsafe || s_e.m_arg_types.size() != e.m_arg_types.size() ) + ERROR(sp, E0000, "Non-scalar cast to " << this->context.m_ivars.fmt_type(tgt_ty) << " to " << this->context.m_ivars.fmt_type(src_ty)); + // TODO: Equate inner types + this->context.equate_types(sp, tgt_ty, src_ty); ) ) ), |