mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:29:14 +02:00
* don't attempt to load the VMT of a niln when taking the address of a
class method (mantis #30706) git-svn-id: trunk@34641 -
This commit is contained in:
parent
350ca0063e
commit
233622157c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15242,6 +15242,7 @@ tests/webtbs/tw30572.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw3063.pp svneol=native#text/plain
|
tests/webtbs/tw3063.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3064.pp svneol=native#text/plain
|
tests/webtbs/tw3064.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw30666.pp svneol=native#text/plain
|
tests/webtbs/tw30666.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw30706.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3073.pp svneol=native#text/plain
|
tests/webtbs/tw3073.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3082.pp svneol=native#text/plain
|
tests/webtbs/tw3082.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3083.pp svneol=native#text/plain
|
tests/webtbs/tw3083.pp svneol=native#text/plain
|
||||||
|
@ -368,7 +368,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
typecheckpass(left);
|
typecheckpass(left);
|
||||||
if (po_classmethod in fprocdef.procoptions) and
|
if (po_classmethod in fprocdef.procoptions) and
|
||||||
is_class(left.resultdef) then
|
is_class(left.resultdef) and
|
||||||
|
(left.nodetype<>niln) then
|
||||||
begin
|
begin
|
||||||
left:=cloadvmtaddrnode.create(left);
|
left:=cloadvmtaddrnode.create(left);
|
||||||
typecheckpass(left);
|
typecheckpass(left);
|
||||||
|
24
tests/webtbs/tw30706.pp
Normal file
24
tests/webtbs/tw30706.pp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
TMyMethod = procedure (A: Integer) of object;
|
||||||
|
|
||||||
|
TMyClass = class
|
||||||
|
class procedure Foo(A: Integer);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class procedure TMyClass.Foo(A: Integer);
|
||||||
|
begin
|
||||||
|
Writeln('Got int ', A);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CallMethod(M: TMyMethod);
|
||||||
|
begin
|
||||||
|
M(123);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
CallMethod({$ifdef FPC_OBJFPC} @ {$endif} TMyClass(nil).Foo);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user