mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 21:10:11 +02:00
* throw an error if varargs is used without appropriate calling conventions, resolves #40342
This commit is contained in:
parent
d809b4ba98
commit
4a4eadc60e
@ -649,7 +649,7 @@ implementation
|
|||||||
{ both must be defined now }
|
{ both must be defined now }
|
||||||
if not((po_external in pd.procoptions) or
|
if not((po_external in pd.procoptions) or
|
||||||
(pd.typ=procvardef)) or
|
(pd.typ=procvardef)) or
|
||||||
not(pd.proccalloption in (cdecl_pocalls + [pocall_stdcall])) then
|
not(pd.proccalloption in cstylearrayofconst) then
|
||||||
Message(parser_e_varargs_need_cdecl_and_external);
|
Message(parser_e_varargs_need_cdecl_and_external);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
16
tests/tbf/tw40342.pp
Normal file
16
tests/tbf/tw40342.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ %fail }
|
||||||
|
{$mode objfpc}
|
||||||
|
|
||||||
|
program test;
|
||||||
|
|
||||||
|
type
|
||||||
|
TMyRecord = record
|
||||||
|
end;
|
||||||
|
|
||||||
|
function printf(format: PChar): Integer; external; varargs;
|
||||||
|
|
||||||
|
var
|
||||||
|
r: TMyRecord;
|
||||||
|
begin
|
||||||
|
printf('test', r); // Fatal: Internal error 2004102303
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user