View Issue Details

IDProjectCategoryView StatusLast Update
0036536FPCCompilerpublic2020-01-08 19:43
ReporterHartmut Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Platformi386OSWindows 
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+}

interface

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

type
  TForm1 = class(TForm)
  private
  public
  end;

var Form1: TForm1;

implementation

{$R *.lfm}

end.
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 https://forum.lazarus.freepascal.org/index.php/topic,48059.msg345520.html#msg345520
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Hartmut

2020-01-08 19:18

reporter  

project1.zip (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: project1.zip
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