Skip to content

Multiline strings project compiles in Delphi but fails in Freepascal (main today)

This code compiles in Delphi 12.3 but in FPC fails with an error message that is completely bogus: a character position that does not exist:

program Project2;
{$ifdef fpc}{$mode delphi}{$endif}{$H+}
begin
writeln(
'''
 ____  _       _            ____                     _
| __ )| | __ _(_)___  ___  |  _ \ __ _ ___  ___ __ _| |
|  _ \| |/ _` | / __|/ _ \ | |_) / _` / __|/ __/ _` | |
| |_) | | (_| | \__ \  __/ |  __/ (_| \__ \ (_| (_| | |
|____/|_|\__,_|_|___/\___| |_|   \__,_|___/\___\__,_|_|
'''
);
readln;
end.
Project2.pas(7,130) Fatal: Illegal character "'|'" ($7C)

I triple checked that the file does not contain possibly illegal characters in the bogus positions. It is not an editor or platform issue: same error on Linux and Windows, Lazarus and Geany and commandline compile. The mode seems not important, both mode delphi and delphiunicode tested.

Edited by Thaddy de Koning
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information