View Issue Details

IDProjectCategoryView StatusLast Update
0036536FPCCompilerpublic2020-01-08 19:43
ReporterHartmut Assigned ToJonas Maebe  
Status resolvedResolutionwon't fix 
Product Version3.3.1 
Summary0036536: {$IF LCL_FullVersion >= xxx} does not work within a uses clause (unit LCLVersion not "valid")
DescriptionWhen I compile the following code, I get:
unit1.pas(10,5) Error: Incompatible types: got "AnsiString" expected "Int64"
unit1.pas(10,5) Error: Compile time expression: Wanted Boolean but got <erroneous type> at IF or ELSEIF

unit Unit1;

{$mode objfpc}{$H+}


 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
{$IF LCL_FullVersion >= 1080000}
 SpinEx, // this unit does not exist before LCL 1.8.0

  TForm1 = class(TForm)

var Form1: TForm1;


{$R *.lfm}

Steps To ReproduceCompile the attached demo program.
Additional InformationI used Lazarus ver=2.1.0 rev=62449 for this test, but howardpc wrote in the forum "I think the Lazarus version is immaterial. The problem is with the FPC parser not having evaluated the constants in the LCLVersion unit in time to interpret the $IF correctly (or something of the sort) in,48059.msg345520.html#msg345520
TagsNo tags attached.
Fixed in Revision
Attached Files



2020-01-08 19:18

reporter (2,600 bytes)

Jonas Maebe

2020-01-08 19:43

manager   ~0120270

Units are only loaded once the entire uses clause is parsed. What you want to do requires the use of an include file.

Issue History

Date Modified Username Field Change
2020-01-08 19:18 Hartmut New Issue
2020-01-08 19:18 Hartmut File Added:
2020-01-08 19:43 Jonas Maebe Assigned To => Jonas Maebe
2020-01-08 19:43 Jonas Maebe Status new => resolved
2020-01-08 19:43 Jonas Maebe Resolution open => won't fix
2020-01-08 19:43 Jonas Maebe FPCTarget => -
2020-01-08 19:43 Jonas Maebe Note Added: 0120270