summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-01-05 22:39:16 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-01-05 22:39:16 +0000
commit89d5db772d9a951a6c1560842ef1832d218ea978 (patch)
tree961f8e65a9c5b68edb6aea633b503e4b8b253ed3 /tests
parent73515cb2bfe388093e2c28b97025b081c608a763 (diff)
downloadfpc-89d5db772d9a951a6c1560842ef1832d218ea978.tar.gz
* weight currency->float conversions the same regardless if
the currency type is handled by the integer unit or the x87 fpu, resolves #38309 git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@48089 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests')
-rw-r--r--tests/webtbs/tw38309.pp56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/webtbs/tw38309.pp b/tests/webtbs/tw38309.pp
new file mode 100644
index 0000000000..a33ef45053
--- /dev/null
+++ b/tests/webtbs/tw38309.pp
@@ -0,0 +1,56 @@
+program c;
+
+{$mode objfpc}
+
+uses
+ Math;
+
+type
+ generic TBase<T> = class
+ private const
+ AConst = 1;
+ private
+ GenVarA: T;
+ GenVarB: T;
+ function Foo: Boolean;
+ end;
+
+ function TBase.Foo: Boolean;
+ begin
+ //Fails with trunk win-64 if TCur type is defined (e.g. not commented out) (*)
+ Result := SameValue(AConst, GenVarB);
+
+ //Fails with trunk win-64, EVEN if TCur definition is commented out
+ //Fails with 3.2.0 win-32, EVEN if TCur definition is commented out
+ //Fails with 3.2.0 win-64, EVEN if TCur definition is commented out, if it is defined it gives the errormesage twice for this line
+ Result := SameValue(GenVarA, GenVarB);
+
+ //Fails with trunk win-64 if TCur type is defined (e.g. not commented out)
+ Result := SameValue(GenVarA, AConst);
+ end;
+
+type
+ TCur = specialize TBase<Currency>;
+
+const
+ CurConst = 1;
+var
+ CurVarA: Currency = 1;
+ CurVarB: Currency = 2;
+
+begin
+ //Fails with trunk win-64
+ SameValue(CurConst, CurVarA);
+
+ //Fails with 3.2.0 win-64
+ SameValue(Currency(CurConst), CurVarA);
+
+ //Fails with 3.2.0 win-64
+ SameValue(CurVarA, CurVarB);
+
+ //Fails with trunk win-64
+ SameValue(CurVarA, CurConst);
+
+ //Fails with 3.2.0 win-64
+ SameValue(CurVarA, Currency(CurConst));
+end.