diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-08-26 15:09:03 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-08 03:00:22 -0400 |
commit | fb1e0a5da67f075ae4f487e111fcf69d1dfcd42f (patch) | |
tree | bdc550ef2f1f229b01bec816620bf58bfefc358a /testsuite/tests/ffi | |
parent | ebbb1fa20f0acb545e9c35576bc0e6f6ec1170a5 (diff) | |
download | haskell-fb1e0a5da67f075ae4f487e111fcf69d1dfcd42f.tar.gz |
ffi: Don't allow wrapper stub with CApi convention
Fixes #20272
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r-- | testsuite/tests/ffi/should_fail/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/capi_wrapper.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/capi_wrapper.stderr | 3 |
3 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_fail/all.T b/testsuite/tests/ffi/should_fail/all.T index afe4370273..ce1c10534e 100644 --- a/testsuite/tests/ffi/should_fail/all.T +++ b/testsuite/tests/ffi/should_fail/all.T @@ -24,3 +24,5 @@ test('UnsafeReenter', [omit_ways(threaded_ways), exit_code(1)], compile_and_run, ['UnsafeReenterC.c']) + +test('capi_wrapper', normal, compile_fail, ['']) diff --git a/testsuite/tests/ffi/should_fail/capi_wrapper.hs b/testsuite/tests/ffi/should_fail/capi_wrapper.hs new file mode 100644 index 0000000000..eb29e617e8 --- /dev/null +++ b/testsuite/tests/ffi/should_fail/capi_wrapper.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE CApiFFI #-} +import Foreign + +foreign import capi "wrapper" + wrapBool :: Bool -> IO (FunPtr Bool) + +main = pure () diff --git a/testsuite/tests/ffi/should_fail/capi_wrapper.stderr b/testsuite/tests/ffi/should_fail/capi_wrapper.stderr new file mode 100644 index 0000000000..607e228ddd --- /dev/null +++ b/testsuite/tests/ffi/should_fail/capi_wrapper.stderr @@ -0,0 +1,3 @@ + +capi_wrapper.hs:4:21: error: + Wrapper stubs can't be used with CApiFFI. |