mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 02:48:07 +02:00
* a function can't be used to implicitely specialize a specialized procedure variable parameter and vice versa
+ added test
This commit is contained in:
parent
a5f3040da5
commit
c0fa45dc92
@ -945,6 +945,11 @@ uses
|
||||
if target_proc.paras.count<>caller_proc.paras.count then
|
||||
exit;
|
||||
|
||||
{ a mixture of functions and procedures is not allowed }
|
||||
if (not assigned(target_proc.returndef) or is_void(target_proc.returndef)) xor
|
||||
(not assigned(caller_proc.returndef) or is_void(caller_proc.returndef)) then
|
||||
exit;
|
||||
|
||||
{ reject generics with constants }
|
||||
for i:=0 to target_proc.genericdef.genericparas.count-1 do
|
||||
if tsym(target_proc.genericdef.genericparas[i]).typ=constsym then
|
||||
|
21
tests/test/timpfuncspez37.pp
Normal file
21
tests/test/timpfuncspez37.pp
Normal file
@ -0,0 +1,21 @@
|
||||
{ %FAIL }
|
||||
|
||||
program timpfuncspez37;
|
||||
|
||||
{$mode objfpc}
|
||||
{$modeswitch implicitfunctionspecialization}
|
||||
|
||||
type
|
||||
generic TTestFunc<T> = procedure(aArg1: T);
|
||||
|
||||
generic procedure DoTest<T>(aArg: specialize TTestFunc<T>);
|
||||
begin
|
||||
end;
|
||||
|
||||
function TestFunc(aArg1: LongInt): LongInt;
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
DoTest(@TestFunc);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user