tw2046.pp 817 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. { %fail }
  2. { Source provided for Free Pascal Bug Report 2046 }
  3. { Submitted by "Mattias Gaertner" on 2002-07-17 }
  4. { e-mail: [email protected] }
  5. program printftest;
  6. {$mode objfpc}{$H+}
  7. const
  8. {$ifdef win32}
  9. libc='msvcrt';
  10. {$else}
  11. libc='c';
  12. {$endif}
  13. procedure sprintf(a, fm: pchar; args: array of const); cdecl; external libc;
  14. procedure print(args: array of const);
  15. var
  16. a : array[0..255] of char;
  17. begin
  18. { THis is not supported. It needs runtime support that will iterate through all
  19. array of const elements and pass them on the stack dependent on the type
  20. For now it should print an error, because it generates invalid code }
  21. sprintf(a,'a number %i',args);
  22. writeln(a);
  23. if a<>'a number 3333' then
  24. begin
  25. writeln('Error!');
  26. halt(1);
  27. end;
  28. end;
  29. begin
  30. print([3333]);
  31. end.