Commit dc4ae7b7 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Check the calling convention of foreign imported labels is supported

Fixes 2276_ghci on Win64
parent 4202879d
......@@ -203,12 +203,14 @@ tcFImport d = pprPanic "tcFImport" (ppr d)
\begin{code}
tcCheckFIType :: Type -> [Type] -> Type -> ForeignImport -> TcM ForeignImport
tcCheckFIType sig_ty arg_tys res_ty idecl@(CImport _ _ _ (CLabel _))
tcCheckFIType sig_ty arg_tys res_ty (CImport cconv safety mh l@(CLabel _))
= ASSERT( null arg_tys )
do { checkCg checkCOrAsmOrLlvmOrInterp
; check (isFFILabelTy res_ty) (illegalForeignTyErr empty sig_ty)
; return idecl } -- NB check res_ty not sig_ty!
-- In case sig_ty is (forall a. ForeignPtr a)
do checkCg checkCOrAsmOrLlvmOrInterp
-- NB check res_ty not sig_ty!
-- In case sig_ty is (forall a. ForeignPtr a)
check (isFFILabelTy res_ty) (illegalForeignTyErr empty sig_ty)
cconv' <- checkCConv cconv
return (CImport cconv' safety mh l)
tcCheckFIType sig_ty arg_tys res_ty (CImport cconv safety mh CWrapper) = do
-- Foreign wrapper (former f.e.d.)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment