Skip to content

Surprising behavior with CPP extension

The CPP language extension performs macro substitutions in Haskell comments. I see why it does but it seems like eliding the comments before pre-processing would be less surprising. Eg. compiling:

{-# LANGUAGE CPP -#}

-- | Some folder foo/bar/*

gives the error:

error: unterminated comment
-- | Some folder foo/bar/*

because the /* in the comment is interpreted as starting a C comment.

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