Syntax error when using logical operator with generic boolean functions
Original Reporter info from Mantis: dmz73 @dmz73
-
Reporter name:
Original Reporter info from Mantis: dmz73 @dmz73
- Reporter name:
Description:
When generic function that returns boolean result is used in another generic function inside IF statement with logical operator (OR/AND) the compiler reports an error.
If logical operators is not used then compiler works OK.
Steps to reproduce:
program Project1;
{$mode delphi}
type
{ TRec1 }
TRec1<T> = record
class function IsV1: boolean; static;
class function IsV2: boolean; static;
end;
{ TRec2 }
TRec2<T> = record
function Test: boolean;
end;
{ TRec1 }
class function TRec1<T>.IsV1: boolean;
begin
result := true;
end;
class function TRec1<T>.IsV2: boolean;
begin
result := true;
end;
{ TRec2 }
function TRec2<T>.Test: boolean;
begin
// this compiles
if TRec1<T>.IsV1 then result := true
else if TRec1<T>.IsV2 then result := true
else result := false;
// this reports an error
if TRec1<T>.IsV1 or TRec1<T>.IsV2 then result := true
else result := false;
end;
begin
end.
Mantis conversion info:
- Mantis ID: 37264
- OS: Windows
- OS Build: 10
- Platform: x86_64
- Version: 3.2.0