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

* output a proper error message in case number+nil is encountered (just like
it's already done for nil+number and nil-number)

git-svn-id: trunk@28225 -

nickysn 11 жил өмнө
parent
commit
6d54046300

+ 1 - 0
.gitattributes

@@ -9617,6 +9617,7 @@ tests/tbf/tb0244.pp svneol=native#text/pascal
 tests/tbf/tb0245.pp svneol=native#text/pascal
 tests/tbf/tb0246.pp svneol=native#text/pascal
 tests/tbf/tb0247.pp svneol=native#text/pascal
+tests/tbf/tb0248.pp svneol=native#text/pascal
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain

+ 2 - 0
compiler/nadd.pas

@@ -1970,6 +1970,8 @@ implementation
             inserttypeconv(left,get_int_type_for_pointer_arithmetic(rd));
             if nodetype=addn then
               begin
+                if (rt=niln) then
+                  CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,'NIL');
                 if not(cs_extsyntax in current_settings.moduleswitches) or
                    (not (is_pchar(ld) or is_chararray(ld) or is_open_chararray(ld) or is_widechar(ld) or is_widechararray(ld) or is_open_widechararray(ld)) and
                     not(cs_pointermath in current_settings.localswitches) and

+ 8 - 0
tests/tbf/tb0248.pp

@@ -0,0 +1,8 @@
+{ %FAIL }
+
+program tb0248;
+var
+  p: PByte;
+begin
+  p := 5 + nil;
+end.