There are multiple issues with the way constant-generic function calls are parsed in {$mode Delphi}
Original Reporter info from Mantis: Akira1364
-
Reporter name:
Original Reporter info from Mantis: Akira1364
- Reporter name:
Description:
See the comments in the program provided below.
program Bug;
{$mode Delphi}
function ParsedWrong<const N: PtrUInt>: PtrUInt;
begin
Result := N + 2;
end;
var I: PtrUInt;
begin
// Only one error will be shown at a time, so to see the second error you'll need
// to comment out the first code block.
// ↓↓↓ Suggests to replace a not-illegal expression with an actually-illegal expression
// Bug.pas(19,24) Error: Illegal expression
// Bug.pas(19,25) Fatal: Syntax error, ")" expected but ";" found
I := ParsedWrong<12>();
WriteLn(I);
// ↓↓↓ Suggests a completely unnecessary semi-colon needs to be added
// Bug.pas(25,23) Error: Illegal expression
// Bug.pas(26,3) Fatal: Syntax error, ";" expected but "identifier WRITELN" found
I := ParsedWrong<12>;
WriteLn(I);
end.
Steps to reproduce:
Compile provided example program.
Mantis conversion info:
- Mantis ID: 38628
- OS: Windows
- OS Build: 10
- Build: Trunk
- Platform: x86_64
- Version: 3.3.1