bug0272.pp 527 B

12345678910111213141516171819202122232425262728293031323334
  1. program test_const_string;
  2. function astring(s :string) : string;
  3. begin
  4. astring:='Test string'+s;
  5. end;
  6. procedure testvar(var s : string);
  7. begin
  8. writeln('testvar s is "',s,'"');
  9. end;
  10. procedure testconst(const s : string);
  11. begin
  12. writeln('testconst s is "',s,'"');
  13. end;
  14. procedure testvalue(s : string);
  15. begin
  16. writeln('testvalue s is "',s,'"');
  17. end;
  18. const
  19. s : string = 'test';
  20. begin
  21. testvalue(astring('e'));
  22. testconst(astring(s));
  23. testconst(astring(45));
  24. {testvar(astring);refused a compile time }
  25. end.