Commit d6ff372f authored by pcapriotti's avatar pcapriotti

Add testcase for #5664.

parent 47c2cb0c
module T5664 where
import Foreign
import Foreign.C
data D = D
newtype I = I CInt
foreign import ccall "dynamic"
mkFun1 :: FunPtr (CInt -> IO ()) -> CInt -> IO ()
foreign import ccall "dynamic"
mkFun2 :: FunPtr (I -> IO ()) -> CInt -> IO ()
foreign import ccall "dynamic"
mkFun3 :: FunPtr (D -> IO ()) -> CInt -> IO ()
foreign import ccall "wrapper"
mkCallBack1 :: IO CInt -> IO (FunPtr (IO CInt))
foreign import ccall "wrapper"
mkCallBack2 :: IO CInt -> IO (FunPtr (IO I))
foreign import ccall "wrapper"
mkCallBack3 :: IO CInt -> IO (FunPtr (IO D))
T5664.hs:15:1:
Unacceptable argument type in foreign declaration:
FunPtr (D -> IO ())
When checking declaration:
foreign import ccall safe "dynamic" mkFun3
:: FunPtr (D -> IO ()) -> CInt -> IO ()
T5664.hs:24:1:
Unacceptable result type in foreign declaration: IO (FunPtr (IO D))
When checking declaration:
foreign import ccall safe "wrapper" mkCallBack3
:: IO CInt -> IO (FunPtr (IO D))
...@@ -10,3 +10,4 @@ test('ccfail004', only_compiler_types(['ghc']), multimod_compile_fail, ['ccfail0 ...@@ -10,3 +10,4 @@ test('ccfail004', only_compiler_types(['ghc']), multimod_compile_fail, ['ccfail0
test('ccfail005', only_compiler_types(['ghc']), compile_fail, ['']) test('ccfail005', only_compiler_types(['ghc']), compile_fail, [''])
test('ccall_value', normal, compile_fail, ['']) test('ccall_value', normal, compile_fail, [''])
test('capi_value_function', normal, compile_fail, ['']) test('capi_value_function', normal, compile_fail, [''])
test('T5664', normal, compile_fail, ['-v0'])
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