2
0
Эх сурвалжийг харах

* don't try to range check ordconst nodes being actually classes

git-svn-id: trunk@7797 -
florian 18 жил өмнө
parent
commit
03951d793a

+ 1 - 0
.gitattributes

@@ -6333,6 +6333,7 @@ tests/tbs/tb0535.pp svneol=native#text/plain
 tests/tbs/tb0536.pp svneol=native#text/plain
 tests/tbs/tb0537.pp svneol=native#text/plain
 tests/tbs/tb0538.pp svneol=native#text/plain
+tests/tbs/tb0539.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain
 tests/tbs/ub0119.pp svneol=native#text/plain

+ 3 - 2
compiler/ncon.pas

@@ -621,8 +621,9 @@ implementation
       begin
         result:=nil;
         resultdef:=typedef;
-        { only do range checking when explicitly asked for it }
-        if rangecheck then
+        { only do range checking when explicitly asked for it
+          and if the type can be range checked, see tests/tbs/tb0539.pp }
+        if rangecheck and (resultdef.typ in [orddef,enumdef]) then
            testrange(resultdef,value,false);
       end;
 

+ 11 - 0
tests/tbs/tb0539.pp

@@ -0,0 +1,11 @@
+{$mode delphi}
+const
+  o = TObject(0);
+
+var
+  o2 : TObject;
+
+{$r+}
+begin
+  o2:=o;
+end.