From dd91f16e461c04bd4528c79f2ab5d96f8ac759e1 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 2 Feb 2017 22:34:02 +0800 Subject: Codegen C - Fix incorrect impl of Fn* for fn pointers --- src/trans/codegen_c.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index 4ea2e54d..73f068a3 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -1083,8 +1083,8 @@ namespace { auto arg_ty = ::HIR::TypeRef::new_unit(); for(const auto& ty : te->m_arg_types) arg_ty.m_data.as_Tuple().push_back( ty.clone() ); - m_of << " " << Trans_Mangle(fcn_p) << "("; emit_ctype(type, FMT_CB(ss, ss << "ptr";)); m_of << ", "; emit_ctype(arg_ty, FMT_CB(ss, ss << "args";)); m_of << ") {\n"; - m_of << "\treturn ptr("; + m_of << " " << Trans_Mangle(fcn_p) << "("; emit_ctype(type, FMT_CB(ss, ss << "*ptr";)); m_of << ", "; emit_ctype(arg_ty, FMT_CB(ss, ss << "args";)); m_of << ") {\n"; + m_of << "\treturn (*ptr)("; for(unsigned int i = 0; i < te->m_arg_types.size(); i++) { if(i != 0) m_of << ", "; -- cgit v1.2.3