Skip to content

CPP strips out C-style comments

The following code fails to compiler with ``y not in scope:

{-# LANGUAGE CPP #-}
module Foo (x) where

x = ([y], z)

-- Oh, noes! Here comes a C-style comment: /usr/local/*
y = 42

-- And now let's close it */Setup.hs accidentally
z = 23

Apparently, the part between the /* and the */ got stripped out by the preprocessor. If we use a gcc's CPP mode, we should at least pass it some options to prevent this from happening.

Trac metadata
Trac field Value
Version 6.10.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Driver
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