* 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:
Jonas Maebe 2016-10-07 16:41:32 +00:00
parent 350ca0063e
commit 233622157c
3 changed files with 27 additions and 1 deletions

1
.gitattributes vendored
View File

@ -15242,6 +15242,7 @@ tests/webtbs/tw30572.pp svneol=native#text/plain
tests/webtbs/tw3063.pp svneol=native#text/plain
tests/webtbs/tw3064.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/tw3082.pp svneol=native#text/plain
tests/webtbs/tw3083.pp svneol=native#text/plain

View File

@ -368,7 +368,8 @@ implementation
begin
typecheckpass(left);
if (po_classmethod in fprocdef.procoptions) and
is_class(left.resultdef) then
is_class(left.resultdef) and
(left.nodetype<>niln) then
begin
left:=cloadvmtaddrnode.create(left);
typecheckpass(left);

24
tests/webtbs/tw30706.pp Normal file
View 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.