mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 15:29:14 +02:00
* handle explicit typecasts of procdefs to procvardefs always via
proc_to_procdef, because a methodpointer may have to be discarded git-svn-id: trunk@23929 -
This commit is contained in:
parent
5152c86932
commit
0ad9f345dd
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -9837,6 +9837,7 @@ tests/tbs/tb0591.pp svneol=native#text/pascal
|
|||||||
tests/tbs/tb0592.pp svneol=native#text/plain
|
tests/tbs/tb0592.pp svneol=native#text/plain
|
||||||
tests/tbs/tb0593.pp svneol=native#text/pascal
|
tests/tbs/tb0593.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb0594.pp svneol=native#text/plain
|
tests/tbs/tb0594.pp svneol=native#text/plain
|
||||||
|
tests/tbs/tb0595.pp svneol=native#text/plain
|
||||||
tests/tbs/tb205.pp svneol=native#text/plain
|
tests/tbs/tb205.pp svneol=native#text/plain
|
||||||
tests/tbs/tbs0594.pp svneol=native#text/pascal
|
tests/tbs/tbs0594.pp svneol=native#text/pascal
|
||||||
tests/tbs/ub0060.pp svneol=native#text/plain
|
tests/tbs/ub0060.pp svneol=native#text/plain
|
||||||
|
@ -2281,8 +2281,13 @@ implementation
|
|||||||
{ Handle explicit type conversions }
|
{ Handle explicit type conversions }
|
||||||
if nf_explicit in flags then
|
if nf_explicit in flags then
|
||||||
begin
|
begin
|
||||||
{ do common tc_equal cast }
|
{ do common tc_equal cast, except when dealing with proc -> procvar
|
||||||
convtype:=tc_equal;
|
(may have to get rid of method pointer) }
|
||||||
|
if (left.resultdef.typ<>procdef) or
|
||||||
|
(resultdef.typ<>procvardef) then
|
||||||
|
convtype:=tc_equal
|
||||||
|
else
|
||||||
|
convtype:=tc_proc_2_procvar;
|
||||||
|
|
||||||
{ ordinal constants can be resized to 1,2,4,8 bytes }
|
{ ordinal constants can be resized to 1,2,4,8 bytes }
|
||||||
if (left.nodetype=ordconstn) then
|
if (left.nodetype=ordconstn) then
|
||||||
|
25
tests/tbs/tb0595.pp
Normal file
25
tests/tbs/tb0595.pp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{$mode delphi}{$h+}
|
||||||
|
|
||||||
|
type
|
||||||
|
tc = class
|
||||||
|
class procedure test; static;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tp = procedure;
|
||||||
|
|
||||||
|
var
|
||||||
|
global: longint;
|
||||||
|
|
||||||
|
class procedure tc.test;
|
||||||
|
begin
|
||||||
|
global:=1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
p: tp;
|
||||||
|
begin
|
||||||
|
p:=tp(tc.test);
|
||||||
|
p();
|
||||||
|
if global<>1 then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user