toperator6.pp 634 B

1234567891011121314151617181920212223242526272829303132333435
  1. {$mode objfpc}
  2. {$R+}
  3. type Tconstexprint=record
  4. overflow:boolean;
  5. case signed:boolean of
  6. false:
  7. (uvalue:qword);
  8. true:
  9. (svalue:int64);
  10. end;
  11. operator := (const u:qword):Tconstexprint;
  12. begin
  13. result.overflow:=false;
  14. result.signed:=false;
  15. result.uvalue:=u;
  16. end;
  17. operator := (const s:int64):Tconstexprint;
  18. begin
  19. result.overflow:=false;
  20. result.signed:=true;
  21. result.svalue:=s;
  22. end;
  23. var
  24. value : tconstexprint;
  25. begin
  26. // Here it should choose the int64 code instead of qword
  27. value:=-128;
  28. // Here it should choose the qword
  29. value:=high(int64)+100;
  30. end.