#line pragmas not respected inside nested comments
If one tries to compile a .hs file, with the -cppoption and the file containsC-style comments (/* comment */), then the linenumbersGHC reportsare wrong. Minimal file exhibiting the error:---{-/* * Copyright (c) 2005 Jesper Louis Andersen<jlouis@mongers.org> * * Permission to use, copy, modify, and distribute thissoftware for any * purpose with or without fee is hereby granted,provided that the above * copyright notice and this permission notice appearin all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORDISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIEDWARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THEAUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIALDAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA ORPROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUSACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THISSOFTWARE. */-}c = 3 * "string"main = putStrLn $ show c----; ghc -cpp tmp.hs tmp.hs:6: No instance for (Num [Char]) arising from use of `*' at tmp.hs:6 In the definition of `c': c = 3 * "string"Which is clearly wrong, since ``c'' is not defined online 6. Note I am not sure wether it is in the parser, or it israther in compilationchain where cpp gets invoked one has to look for theerror. I have filedit as a parser-bug nonetheless.Fix: cpp(1) seems to output comments in the style# xx "filename"where ``xx'' is a number stating the linenumber in theoriginal file.Keeping track of this probably fixes the bug.CPP version: GNU CPP from GCC 3.3.5Operating System: OpenBSD 3.6-current (GENERIC) #1: SunFeb 20 10:23:54 CET 2005Submitter: Jesper Louis Andersen <jlouis@mongers.org>