Skip to content

multiline literals doesn't work with CPP extension.

If LANGUAGE CPP is enabled then multiline literals stops working. Steps to reproduce.

  1. write a program with multiline literal: cat 1.hs
test = "mutli\
   \line"

main = putStrLn test
  1. it should compile without CPP:

ghc 1.hs [1 of 1] Compiling Main ( 1.hs, 1.o ) Linking 1 ...

  1. compile it with CPP extension

Expected result: program compiles

ghc 1.hs
[1 of 1] Compiling Main             ( 1.hs, 1.o )
Linking 1 ...

Actual result: compilation breaks

ghc -XCPP 1.hs
[1 of 1] Compiling Main             ( 1.hs, 1.o ) [flags changed]

1.hs:1:18:
    lexical error in string/character literal at character 'l'

At least ghc-7.8.4 and ghc-7.10 are affected.

Trac metadata
Trac field Value
Version 7.10.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