From 2f374a37b7ad878b277916d0fe7c4d410328e207 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 22 Dec 2019 22:06:26 +0000 Subject: [PATCH] * patch by Bart Broersma to allow to declare "LongInt = AnsiString" comparison operator in non-macpas modes, resolves #29460 git-svn-id: trunk@43709 - --- .gitattributes | 1 + compiler/htypechk.pas | 1 + tests/webtbs/tw29460.pp | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 tests/webtbs/tw29460.pp diff --git a/.gitattributes b/.gitattributes index 621c1b4299..582bc96857 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17515,6 +17515,7 @@ tests/webtbs/tw2943.pp svneol=native#text/plain tests/webtbs/tw2944.pp svneol=native#text/plain tests/webtbs/tw29444.pp svneol=native#text/pascal tests/webtbs/tw2946.pp svneol=native#text/plain +tests/webtbs/tw29460.pp svneol=native#text/pascal tests/webtbs/tw29471.pp svneol=native#text/plain tests/webtbs/tw2949.pp svneol=native#text/plain tests/webtbs/tw29491.pp svneol=native#text/plain diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 5bb207cc89..63ad70d082 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -333,6 +333,7 @@ implementation (treetyp in order_theoretic_operators) ) or ( + (m_mac in current_settings.modeswitches) and is_stringlike(rd) and (ld.typ=orddef) and (treetyp in string_comparison_operators)) or diff --git a/tests/webtbs/tw29460.pp b/tests/webtbs/tw29460.pp new file mode 100644 index 0000000000..fe773204e2 --- /dev/null +++ b/tests/webtbs/tw29460.pp @@ -0,0 +1,18 @@ +program project1; + +{$mode objfpc}{$H+} +{$modeswitch advancedrecords} + +operator = (z1: LongInt; z2 : ansistring) b : boolean; +begin + b := false; +end; + +var + i: longint; + s: string; +begin + if i = s then + halt(1); + writeln('ok'); +end.