mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 02:27:56 +02:00
* fixed mantis #9522: no longer allow typecasting ordinal constants
to complex types (caused a lot of internal errors later on, and was also Delphi-incompatible) git-svn-id: trunk@8369 -
This commit is contained in:
parent
498da17875
commit
1ee8207ffa
10
.gitattributes
vendored
10
.gitattributes
vendored
@ -5828,6 +5828,7 @@ tests/tbf/tb0199a.pp -text
|
||||
tests/tbf/tb0200.pp svneol=native#text/x-pascal
|
||||
tests/tbf/tb0201.pp svneol=native#text/plain
|
||||
tests/tbf/tb0202.pp svneol=native#text/plain
|
||||
tests/tbf/tb0203.pp svneol=native#text/plain
|
||||
tests/tbf/ub0115.pp svneol=native#text/plain
|
||||
tests/tbf/ub0149.pp svneol=native#text/plain
|
||||
tests/tbf/ub0158a.pp svneol=native#text/plain
|
||||
@ -6214,7 +6215,6 @@ tests/tbs/tb0391.pp svneol=native#text/plain
|
||||
tests/tbs/tb0392.pp svneol=native#text/plain
|
||||
tests/tbs/tb0393.pp svneol=native#text/plain
|
||||
tests/tbs/tb0394.pp svneol=native#text/plain
|
||||
tests/tbs/tb0395.pp svneol=native#text/plain
|
||||
tests/tbs/tb0396.pp svneol=native#text/plain
|
||||
tests/tbs/tb0397.pp svneol=native#text/plain
|
||||
tests/tbs/tb0398.pp svneol=native#text/plain
|
||||
@ -7338,6 +7338,7 @@ tests/webtbf/tw3716.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3738.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3740.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3790.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3812.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3930a.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3931b.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3969.pp svneol=native#text/plain
|
||||
@ -7432,6 +7433,12 @@ tests/webtbf/tw9039d.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9225.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9499.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9499a.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9522.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9522a.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9522b.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9522c.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9522d.pp svneol=native#text/plain
|
||||
tests/webtbf/tw9522e.pp svneol=native#text/plain
|
||||
tests/webtbf/uw0744.pp svneol=native#text/plain
|
||||
tests/webtbf/uw0840a.pp svneol=native#text/plain
|
||||
tests/webtbf/uw0840b.pp svneol=native#text/plain
|
||||
@ -8046,7 +8053,6 @@ tests/webtbs/tw3780.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3782.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3796.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3805.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3812.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3814.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3827.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3829.pp svneol=native#text/plain
|
||||
|
@ -1793,13 +1793,19 @@ implementation
|
||||
|
||||
else
|
||||
begin
|
||||
{ only if the same size or formal def }
|
||||
{ only if the same size or formal def, and }
|
||||
{ don't allow type casting of constants to }
|
||||
{ structured types }
|
||||
if not(
|
||||
(left.resultdef.typ=formaldef) or
|
||||
(
|
||||
not(is_open_array(left.resultdef)) and
|
||||
not(is_array_constructor(left.resultdef)) and
|
||||
(left.resultdef.size=resultdef.size)
|
||||
(left.resultdef.size=resultdef.size) and
|
||||
(not is_constnode(left) or
|
||||
(not(resultdef.typ in [arraydef,recorddef,setdef,stringdef,
|
||||
filedef,variantdef,objectdef]) or
|
||||
is_class_or_interface(resultdef)))
|
||||
) or
|
||||
(
|
||||
is_void(left.resultdef) and
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ %VERSION=1.1 }
|
||||
{ %fail }
|
||||
|
||||
type
|
||||
dummyrec = record
|
||||
i : int64;
|
@ -1,3 +1,5 @@
|
||||
{ %fail }
|
||||
|
||||
{ Source provided for Free Pascal Bug Report 3812 }
|
||||
{ Submitted by "Sergey@michint" on 2005-03-22 }
|
||||
{ e-mail: }
|
7
tests/webtbf/tw9522.pp
Normal file
7
tests/webtbf/tw9522.pp
Normal file
@ -0,0 +1,7 @@
|
||||
{ %fail }
|
||||
|
||||
type T4Char = array[0..3] of char;
|
||||
begin
|
||||
writeln(T4Char(65)[0]);
|
||||
end.
|
||||
|
7
tests/webtbf/tw9522a.pp
Normal file
7
tests/webtbf/tw9522a.pp
Normal file
@ -0,0 +1,7 @@
|
||||
{ %fail }
|
||||
|
||||
type T4Char = array[0..3] of char;
|
||||
begin
|
||||
writeln(ansistring(65));
|
||||
end.
|
||||
|
7
tests/webtbf/tw9522b.pp
Normal file
7
tests/webtbf/tw9522b.pp
Normal file
@ -0,0 +1,7 @@
|
||||
{ %fail }
|
||||
|
||||
type ts = set of 0..7;
|
||||
begin
|
||||
writeln(1 in ts(65));
|
||||
end.
|
||||
|
7
tests/webtbf/tw9522c.pp
Normal file
7
tests/webtbf/tw9522c.pp
Normal file
@ -0,0 +1,7 @@
|
||||
{ %fail }
|
||||
|
||||
type ts = string[1];
|
||||
begin
|
||||
writeln(ts(65));
|
||||
end.
|
||||
|
8
tests/webtbf/tw9522d.pp
Normal file
8
tests/webtbf/tw9522d.pp
Normal file
@ -0,0 +1,8 @@
|
||||
{ %fail }
|
||||
|
||||
type
|
||||
tr = record b: byte; end;
|
||||
begin
|
||||
writeln(tr(65).b);
|
||||
end.
|
||||
|
8
tests/webtbf/tw9522e.pp
Normal file
8
tests/webtbf/tw9522e.pp
Normal file
@ -0,0 +1,8 @@
|
||||
{ %fail }
|
||||
|
||||
type
|
||||
tobj = object b : byte; end;
|
||||
begin
|
||||
writeln(tobj(65).b);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user