mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 00:10:31 +02:00
* give again an error for "in" operations on incompatible set
elements/sets after introduction of support for "longint in set" git-svn-id: trunk@6885 -
This commit is contained in:
parent
07d97e2916
commit
428306051f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7191,6 +7191,7 @@ tests/webtbf/tw8150f.pp svneol=native#text/plain
|
|||||||
tests/webtbf/tw8150g.pp svneol=native#text/plain
|
tests/webtbf/tw8150g.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw8264a.pp svneol=native#text/plain
|
tests/webtbf/tw8264a.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw8398.pp svneol=native#text/plain
|
tests/webtbf/tw8398.pp svneol=native#text/plain
|
||||||
|
tests/webtbf/tw8528.pp svneol=native#text/plain
|
||||||
tests/webtbf/uw0744.pp svneol=native#text/plain
|
tests/webtbf/uw0744.pp svneol=native#text/plain
|
||||||
tests/webtbf/uw0840a.pp svneol=native#text/plain
|
tests/webtbf/uw0840a.pp svneol=native#text/plain
|
||||||
tests/webtbf/uw0840b.pp svneol=native#text/plain
|
tests/webtbf/uw0840b.pp svneol=native#text/plain
|
||||||
|
@ -268,6 +268,22 @@ implementation
|
|||||||
inserttypeconv(left,s32inttype)
|
inserttypeconv(left,s32inttype)
|
||||||
else
|
else
|
||||||
inserttypeconv(left,u32inttype);
|
inserttypeconv(left,u32inttype);
|
||||||
|
end
|
||||||
|
else if assigned(tsetdef(right.resultdef).elementdef) and
|
||||||
|
not(is_integer(tsetdef(right.resultdef).elementdef) and
|
||||||
|
is_integer(left.resultdef)) then
|
||||||
|
begin
|
||||||
|
{ Dummy type conversion to check things like }
|
||||||
|
{ 'char in set_of_byte'. Can't use is_subequal because that }
|
||||||
|
{ will fail for 'widechar in set_of_char' }
|
||||||
|
{ Can't use the type conversion for integers because then }
|
||||||
|
{ "longint in set_of_byte" will give a range check error }
|
||||||
|
{ instead of false }
|
||||||
|
{ Use a copy of left in case the typeconv node would modify }
|
||||||
|
{ left directly (since we need the original left) }
|
||||||
|
t := ctypeconvnode.create(left.getcopy,tsetdef(right.resultdef).elementdef);
|
||||||
|
typecheckpass(t);
|
||||||
|
t.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ empty set then return false }
|
{ empty set then return false }
|
||||||
|
16
tests/webtbf/tw8528.pp
Normal file
16
tests/webtbf/tw8528.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ %fail }
|
||||||
|
|
||||||
|
program test;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
const
|
||||||
|
AllowedCharSet: set of Byte = [48..60];
|
||||||
|
|
||||||
|
var
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
s := 'test0';
|
||||||
|
if s[5] in AllowedCharSet then
|
||||||
|
Writeln('huh?');
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user