mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 18:47:52 +02:00
Symbolic constants: don't range check on use
If these constants are defined with an explicit type, they are already truncated/checked at that point. If we range check them again on use, we may get errors because at that point there is no explicit type cast any more.
This commit is contained in:
parent
31f74f65b0
commit
3da54dcf9f
@ -328,7 +328,9 @@ implementation
|
||||
begin
|
||||
if p.constdef=nil then
|
||||
internalerror(200403232);
|
||||
p1:=cordconstnode.create(p.value.valueord,p.constdef,true);
|
||||
{ no range checking; if it has a fixed type, the necessary value
|
||||
truncation was already performed at the declaration time }
|
||||
p1:=cordconstnode.create(p.value.valueord,p.constdef,false);
|
||||
end;
|
||||
conststring :
|
||||
begin
|
||||
|
23
tests/tbs/tb0693.pp
Normal file
23
tests/tbs/tb0693.pp
Normal file
@ -0,0 +1,23 @@
|
||||
{ %norun }
|
||||
|
||||
|
||||
{$r+}
|
||||
|
||||
{$mode delphi}
|
||||
|
||||
type
|
||||
TLanguages = (
|
||||
lOne,
|
||||
lTwo,
|
||||
lThree,
|
||||
lFour
|
||||
);
|
||||
|
||||
const
|
||||
LANGUAGE_NONE = TLanguages(255);
|
||||
var
|
||||
Lang: TLanguages;
|
||||
|
||||
begin
|
||||
Lang := LANGUAGE_NONE; //line 20
|
||||
end.
|
Loading…
Reference in New Issue
Block a user