Pārlūkot izejas kodu

Merged revisions 7703 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r7703 | peter | 2007-06-17 16:17:30 +0200 (Sun, 17 Jun 2007) | 2 lines

* test for wrong first match of operator overloading

........

git-svn-id: branches/fixes_2_2@7712 -

peter 18 gadi atpakaļ
vecāks
revīzija
4cabd0e451
2 mainītis faili ar 36 papildinājumiem un 0 dzēšanām
  1. 1 0
      .gitattributes
  2. 35 0
      tests/test/toperator6.pp

+ 1 - 0
.gitattributes

@@ -6766,6 +6766,7 @@ tests/test/toperator2.pp svneol=native#text/plain
 tests/test/toperator3.pp svneol=native#text/plain
 tests/test/toperator4.pp svneol=native#text/plain
 tests/test/toperator5.pp svneol=native#text/plain
+tests/test/toperator6.pp svneol=native#text/plain
 tests/test/tover1.pp svneol=native#text/plain
 tests/test/tover2.pp svneol=native#text/plain
 tests/test/tpackrec.pp svneol=native#text/plain

+ 35 - 0
tests/test/toperator6.pp

@@ -0,0 +1,35 @@
+{$mode objfpc}
+{$R+}
+
+type  Tconstexprint=record
+        overflow:boolean;
+        case signed:boolean of
+          false:
+            (uvalue:qword);
+          true:
+            (svalue:int64);
+      end;
+
+operator := (const u:qword):Tconstexprint;
+begin
+  result.overflow:=false;
+  result.signed:=false;
+  result.uvalue:=u;
+end;
+
+operator := (const s:int64):Tconstexprint;
+begin
+  result.overflow:=false;
+  result.signed:=true;
+  result.svalue:=s;
+end;
+
+
+var
+  value : tconstexprint;
+begin
+  // Here it should choose the int64 code instead of qword
+  value:=-128;
+  // Here it should choose the qword
+  value:=high(int64)+100;
+end.