Skip to content

Wrong line number reported with CPP and line beginning with #

If I compile

{-# LANGUAGE CPP #-}

module Bug where

{-
  # hi there!
-}

*

I'm told of a parse error for the * on line 10. But that * is line 9!

The problem is that, with CPP on, the line number counter gets confused if a line begins with a #, perhaps after whitespace.

I actually hit this and was confused in real code.

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