summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-12-19 17:25:09 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2012-12-19 17:25:09 +0000
commit8daa24645faa696314a20627bbd36042630ad854 (patch)
treea3a7ec86d70b2998f6ce33c4c5a46d4bbe6db7ad /testsuite/tests/ffi
parent8cd4ced57dccc1f4f54d242982209ec61e145700 (diff)
downloadhaskell-8daa24645faa696314a20627bbd36042630ad854.tar.gz
Test Trac #7506
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r--testsuite/tests/ffi/should_fail/T7506.hs6
-rw-r--r--testsuite/tests/ffi/should_fail/T7506.stderr7
-rw-r--r--testsuite/tests/ffi/should_fail/all.T1
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_fail/T7506.hs b/testsuite/tests/ffi/should_fail/T7506.hs
new file mode 100644
index 0000000000..75411bd50f
--- /dev/null
+++ b/testsuite/tests/ffi/should_fail/T7506.hs
@@ -0,0 +1,6 @@
+module Foo where
+
+import Foreign.Ptr
+
+-- foreign import ccall "stdio.h &putchar" c_putchar :: () -> FunPtr (Char -> IO ())
+foreign import ccall "stdio.h &putchar" c_putchar :: Int -> IO ()
diff --git a/testsuite/tests/ffi/should_fail/T7506.stderr b/testsuite/tests/ffi/should_fail/T7506.stderr
new file mode 100644
index 0000000000..e8e95a9275
--- /dev/null
+++ b/testsuite/tests/ffi/should_fail/T7506.stderr
@@ -0,0 +1,7 @@
+
+T7506.hs:6:1:
+ Unacceptable type in foreign declaration: Int -> IO ()
+ A foreign-imported address (via &foo) must have type (Ptr a) or (FunPtr a)
+ When checking declaration:
+ foreign import ccall safe "static stdio.h &putchar" c_putchar
+ :: Int -> IO ()
diff --git a/testsuite/tests/ffi/should_fail/all.T b/testsuite/tests/ffi/should_fail/all.T
index 8da27021d8..cb6ffe9ea6 100644
--- a/testsuite/tests/ffi/should_fail/all.T
+++ b/testsuite/tests/ffi/should_fail/all.T
@@ -11,3 +11,4 @@ test('ccfail005', only_compiler_types(['ghc']), compile_fail, [''])
test('ccall_value', normal, compile_fail, [''])
test('capi_value_function', normal, compile_fail, [''])
test('T5664', normal, compile_fail, ['-v0'])
+test('T7506', normal, compile_fail, [''])