diff options
author | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-08-03 15:24:59 +0000 |
---|---|---|
committer | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-08-03 15:24:59 +0000 |
commit | f8063dc13f164fcd8345de1f91d0fc72142100b4 (patch) | |
tree | 394cf4cba36863e4794264d3395a0b1152f40d68 /tests/tbs | |
parent | 91464758fe6d4a15805cfe6118994882fb96f17c (diff) | |
download | fpc-f8063dc13f164fcd8345de1f91d0fc72142100b4.tar.gz |
* fix for Mantis #34021: if one of the two operators is an array constructor try to use an operator overload for that first before converting it to a set
+ added tests
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@39554 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/tbs')
-rw-r--r-- | tests/tbs/tb0649.pp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/tbs/tb0649.pp b/tests/tbs/tb0649.pp new file mode 100644 index 0000000000..fd27f8dcb7 --- /dev/null +++ b/tests/tbs/tb0649.pp @@ -0,0 +1,50 @@ +{ %NORUN }
+
+program tb0649;
+
+{$mode objfpc}
+
+type
+ TEnum = (
+ eOne,
+ eTwo,
+ eThree
+ );
+
+ TEnumSet = set of TEnum;
+
+ TByteSet = set of Byte;
+
+ TTest = class
+ end;
+
+operator + (aLeft: TTest; aRight: array of Byte): TTest;
+begin
+ Writeln('Array of Byte');
+ Result := aLeft;
+end;
+
+operator + (aLeft: TTest; aRight: TByteSet): TTest;
+begin
+ Writeln('Set of Byte');
+ Result := aLeft;
+end;
+
+operator + (aLeft: TTest; aRight: array of TEnum): TTest;
+begin
+ Writeln('Array of TEnum');
+ Result := aLeft;
+end;
+
+operator + (aLeft: TTest; aRight: TEnumSet): TTest;
+begin
+ Writeln('Set of TEnum');
+ Result := aLeft;
+end;
+
+var
+ t: TTest;
+begin
+ t := t + [1, 2, 3];
+ t := t + [eOne, eTwo];
+end.
|