From f50dec520251605fe0fd6a0a2cf2fb1899484101 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 17 Apr 2016 19:07:26 +0000 Subject: [PATCH] * don't allow implicit type conversions from pointers to c-style blocks in Delphi mode, because unlike for procvars we need full type information to be able to generate a block (mantis #30022) git-svn-id: trunk@33529 - --- .gitattributes | 1 + compiler/symdef.pas | 1 + tests/webtbf/tw30022.pp | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/webtbf/tw30022.pp diff --git a/.gitattributes b/.gitattributes index 741ce4903a..89df43d1fc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13569,6 +13569,7 @@ tests/webtbf/tw2972b.pp svneol=native#text/plain tests/webtbf/tw2983a.pp svneol=native#text/plain tests/webtbf/tw2996.pp svneol=native#text/plain tests/webtbf/tw3000.pp svneol=native#text/plain +tests/webtbf/tw30022.pp svneol=native#text/plain tests/webtbf/tw3047.pp svneol=native#text/plain tests/webtbf/tw3114.pp svneol=native#text/plain tests/webtbf/tw3116.pp svneol=native#text/plain diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 22f87a9365..3ef10648c4 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -6355,6 +6355,7 @@ implementation function tprocvardef.is_addressonly:boolean; begin result:=(not(po_methodpointer in procoptions) and + not(po_is_block in procoptions) and not is_nested_pd(self)) or (po_addressonly in procoptions); end; diff --git a/tests/webtbf/tw30022.pp b/tests/webtbf/tw30022.pp new file mode 100644 index 0000000000..a0d8b02b71 --- /dev/null +++ b/tests/webtbf/tw30022.pp @@ -0,0 +1,22 @@ +{ %fail } + +{ %target=darwin } + +{$mode delphi} +{$modeswitch objectivec1} +{$modeswitch cblocks} + +type + treadabilityHandler = reference to procedure (l :longint); cdecl; + +procedure setReadabilityHandler(ahandler: treadabilityHandler); + begin + end; + +procedure MyHandler(l: longint); +begin +end; + +begin + setReadabilityHandler(@myhandler) +end.