Bizarre parser problem: "Illegal bang-pattern" (something to do with CPP?)
This is a bug in an old ghc (7.4.2), documenting it here mostly in case anybody else comes across it. If you try to compile http://hackage.haskell.org/package/bytestring-builder-0.10.8.1.0/bytestring-builder-0.10.8.1.0.tar.gz , ghc fails with
src/Data/ByteString/Builder/Prim.hs:553:13:
Illegal bang-pattern (use -XBangPatterns):
! br'
However, that file contains a directive
{-# LANGUAGE CPP, BangPatterns, ScopedTypeVariables #-}
at the very top of the file, so we should not be getting this error message. Now here's the bizarre thing: if we compile with cabal --builddir=foo, compilation happens as normal! I ran ghc with --keep-tmp-files, and compared the output of CPP for both variations, and literally the only difference between the two that lines
# 156 "./dist/build/autogen/cabal_macros.h"
in one are
# 156 "./foo/build/autogen/cabal_macros.h"
in the other.
It gets weirder. I replaced the output of src/Data/ByteString/Builder/Prim.hs with the output of cpp, and removed the CPP language directive. If I start with the version that has dist (i.e., the one that results in a compilation error), even adding or removing a single blank line in the header of the file made the parser error go away (where the "header" is the bit with lines such as
# 134 "./dist/build/autogen/cabal_macros.h"
No idea what's going on here; probably not worth investigating further.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |