Skip to content

Top-level bang pattern accepted

When I compile/link

{-# LANGUAGE BangPatterns #-}

module Main where

!(Just x) = Nothing

main = putStrLn "hi there!"

I get

rae:09:50:49 ~/temp> ghc Bug.hs
[1 of 1] Compiling Main             ( Bug.hs, Bug.o )
Linking Bug ...
ld: can't open output file for writing: Bug, errno=21 for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

This bogus code should be rejected more gracefully (and earlier). It actually also loads into GHCi, but shouldn't.

Will fix while I'm in the area.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information