瀏覽代碼

* 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 -

Jonas Maebe 9 年之前
父節點
當前提交
f50dec5202
共有 3 個文件被更改,包括 24 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/symdef.pas
  3. 22 0
      tests/webtbf/tw30022.pp

+ 1 - 0
.gitattributes

@@ -13569,6 +13569,7 @@ tests/webtbf/tw2972b.pp svneol=native#text/plain
 tests/webtbf/tw2983a.pp svneol=native#text/plain
 tests/webtbf/tw2983a.pp svneol=native#text/plain
 tests/webtbf/tw2996.pp svneol=native#text/plain
 tests/webtbf/tw2996.pp svneol=native#text/plain
 tests/webtbf/tw3000.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/tw3047.pp svneol=native#text/plain
 tests/webtbf/tw3114.pp svneol=native#text/plain
 tests/webtbf/tw3114.pp svneol=native#text/plain
 tests/webtbf/tw3116.pp svneol=native#text/plain
 tests/webtbf/tw3116.pp svneol=native#text/plain

+ 1 - 0
compiler/symdef.pas

@@ -6355,6 +6355,7 @@ implementation
     function tprocvardef.is_addressonly:boolean;
     function tprocvardef.is_addressonly:boolean;
       begin
       begin
         result:=(not(po_methodpointer in procoptions) and
         result:=(not(po_methodpointer in procoptions) and
+                 not(po_is_block in procoptions) and
                  not is_nested_pd(self)) or
                  not is_nested_pd(self)) or
                 (po_addressonly in procoptions);
                 (po_addressonly in procoptions);
       end;
       end;

+ 22 - 0
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.