summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-04-23 10:04:03 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-23 11:05:48 -0400
commit907b0f3da6f8fafaa39caba92a5611040f5de786 (patch)
tree62ebbcba9e0f005c0db8c60631258157c3f1680b
parentf6eaf01c14960f9d600d5e4c743efc59c37bd4e3 (diff)
downloadhaskell-907b0f3da6f8fafaa39caba92a5611040f5de786.tar.gz
testsuite: Add testcase for #13587
Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #13587 Differential Revision: https://phabricator.haskell.org/D3474
-rw-r--r--testsuite/tests/th/T13587.hs12
-rw-r--r--testsuite/tests/th/T13587A.hs14
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/th/T13587.hs b/testsuite/tests/th/T13587.hs
new file mode 100644
index 0000000000..2986fd224b
--- /dev/null
+++ b/testsuite/tests/th/T13587.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+import T13587A
+
+main :: IO ()
+main = do
+ let sin' = $$(importDoubleToDouble "sin")
+ cos' = $$(importDoubleToDouble "cos")
+ --
+ print (sin' 0)
+ print (cos' pi)
+
diff --git a/testsuite/tests/th/T13587A.hs b/testsuite/tests/th/T13587A.hs
new file mode 100644
index 0000000000..b144cc2bc6
--- /dev/null
+++ b/testsuite/tests/th/T13587A.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE QuasiQuotes #-}
+
+module T13587A where
+
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+
+importDoubleToDouble :: String -> Q (TExp (Double -> Double))
+importDoubleToDouble fname = do
+ n <- newName fname
+ d <- forImpD CCall unsafe fname n [t|Double -> Double|]
+ addTopDecls [d]
+ unsafeTExpCoerce (varE n)
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index e4d4731f9a..7c98d13fa7 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -381,3 +381,4 @@ test('T13123', normal, compile, ['-v0'])
test('T13098', normal, compile, ['-v0'])
test('T11046', normal, multimod_compile, ['T11046','-v0'])
test('T13366', normal, compile_and_run, ['-lstdc++ -v0'])
+test('T13587', expect_broken(13587), compile_and_run, ['-v0'])