diff options
author | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-12-16 21:43:25 +0000 |
---|---|---|
committer | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-12-16 21:43:25 +0000 |
commit | 2aadceaee189784ca2c74e503f1c7cc675084d69 (patch) | |
tree | e6cf3427f59268b19540b37bd32312c64a4f473c /tests/tbs | |
parent | c5fafe277cea8bd568a0b91544d3332c58e8449f (diff) | |
download | fpc-2aadceaee189784ca2c74e503f1c7cc675084d69.tar.gz |
* apply patch by Blaise.ru to allow record methods to be assigned to method variables as well (this is Delphi compatible)
+ added test
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47794 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/tbs')
-rw-r--r-- | tests/tbs/tb0681.pp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/tbs/tb0681.pp b/tests/tbs/tb0681.pp new file mode 100644 index 0000000000..ab93efb232 --- /dev/null +++ b/tests/tbs/tb0681.pp @@ -0,0 +1,23 @@ +program tb0681; + +{$Mode Delphi} + +type R = record + var X: Integer; + function Foo: Integer; +end; + +function R.Foo: Integer; +begin + result := X +end; + +var F: function : Integer of object; + Z: R = (X:42); +begin + // EXPECTED: gets compiled + // ACTUAL: 'Error: Incompatible types' + F := Z.Foo; + if F() <> 42 then + Halt(1); +end. |