diff options
| -rw-r--r-- | testsuite/tests/th/T13587.hs | 12 | ||||
| -rw-r--r-- | testsuite/tests/th/T13587A.hs | 14 | ||||
| -rw-r--r-- | testsuite/tests/th/all.T | 1 |
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']) |
