[commit: testsuite] master: Test Trac #7506 (30ef58b)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/30ef58bf3e4116e960aafb7f92024c7ee860503b

>---------------------------------------------------------------

commit 30ef58bf3e4116e960aafb7f92024c7ee860503b
Author: Simon Peyton Jones <[email protected]>
Date:   Wed Dec 19 17:25:09 2012 +0000

    Test Trac #7506

>---------------------------------------------------------------

 tests/ffi/should_fail/T7506.hs     |    6 ++++++
 tests/ffi/should_fail/T7506.stderr |    7 +++++++
 tests/ffi/should_fail/all.T        |    1 +
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/tests/ffi/should_fail/T7506.hs b/tests/ffi/should_fail/T7506.hs
new file mode 100644
index 0000000..75411bd
--- /dev/null
+++ b/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/tests/ffi/should_fail/T7506.stderr b/tests/ffi/should_fail/T7506.stderr
new file mode 100644
index 0000000..e8e95a9
--- /dev/null
+++ b/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/tests/ffi/should_fail/all.T b/tests/ffi/should_fail/all.T
index 8da2702..cb6ffe9 100644
--- a/tests/ffi/should_fail/all.T
+++ b/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, [''])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.