mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 20:01:27 +02:00
* fix #40332: apply patch by Rika to avoid a crash when an overload can't be picked outside of a function (e.g. when using intrinsics inside constants)
+ added test
This commit is contained in:
parent
9cc08940dd
commit
d97d34ee9c
@ -3823,7 +3823,7 @@ implementation
|
||||
with generic types as arguments we don't complain in
|
||||
the generic, but only during the specialization }
|
||||
ignoregenericparacall:=false;
|
||||
if df_generic in current_procinfo.procdef.defoptions then
|
||||
if assigned(current_procinfo) and (df_generic in current_procinfo.procdef.defoptions) then
|
||||
begin
|
||||
pt:=tcallparanode(left);
|
||||
while assigned(pt) do
|
||||
|
21
tests/webtbs/tw40332.pp
Normal file
21
tests/webtbs/tw40332.pp
Normal file
@ -0,0 +1,21 @@
|
||||
{$mode objfpc}
|
||||
unit tw40332;
|
||||
|
||||
interface
|
||||
|
||||
function Bsr(const value: byte): byte; internproc: fpc_in_bsr_x;
|
||||
function Bsr(const value: word): cardinal; internproc: fpc_in_bsr_x;
|
||||
function Bsr(const value: dword): cardinal; internproc: fpc_in_bsr_x;
|
||||
{$ifdef cpu64}
|
||||
function Bsr(const value: qword): cardinal; internproc: fpc_in_bsr_x;
|
||||
{$endif}
|
||||
|
||||
type
|
||||
SomeEnum = (A, B, C, D);
|
||||
|
||||
const
|
||||
SomeEnumBits = 1 + Bsr(ord(High(SomeEnum)) or 1);
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user