diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index db86900e..c98d9c59 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -1312,7 +1312,15 @@ namespace { (Pointer, TU_MATCH_DEF( ::HIR::TypeRef::Data, (src_ty.m_data), (s_e), ( - ERROR(sp, E0000, "Invalid cast to pointer"); + ERROR(sp, E0000, "Invalid cast to pointer from " << src_ty); + ), + (Function, + if( e.type == ::HIR::BorrowType::Shared && *e.inner == ::HIR::TypeRef::new_unit() ) { + this->m_completed = true; + } + else { + ERROR(sp, E0000, "Invalid cast to pointer from " << src_ty); + } ), (Primitive, if( s_e != ::HIR::CoreType::Usize ) { |