mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 00:32:21 +02:00
* fix conversion from Objective-C class/protocol to tvarrec (store in
vPointer) (mantis #36362) git-svn-id: trunk@43594 -
This commit is contained in:
parent
cf0716123c
commit
5800ac6213
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15464,6 +15464,7 @@ tests/test/units/classes/ttbits.pp svneol=native#text/pascal
|
|||||||
tests/test/units/classes/ttlist.pp svneol=native#text/plain
|
tests/test/units/classes/ttlist.pp svneol=native#text/plain
|
||||||
tests/test/units/classes/tvclcomobject.pp svneol=native#text/plain
|
tests/test/units/classes/tvclcomobject.pp svneol=native#text/plain
|
||||||
tests/test/units/cocoaall/tw35994.pp svneol=native#text/plain
|
tests/test/units/cocoaall/tw35994.pp svneol=native#text/plain
|
||||||
|
tests/test/units/cocoaall/tw36362.pp svneol=native#text/plain
|
||||||
tests/test/units/cpu/tcpu1.pp svneol=native#text/pascal
|
tests/test/units/cpu/tcpu1.pp svneol=native#text/pascal
|
||||||
tests/test/units/crt/tcrt.pp svneol=native#text/plain
|
tests/test/units/crt/tcrt.pp svneol=native#text/plain
|
||||||
tests/test/units/crt/tctrlc.pp svneol=native#text/plain
|
tests/test/units/crt/tctrlc.pp svneol=native#text/plain
|
||||||
|
@ -843,10 +843,12 @@ implementation
|
|||||||
if iscvarargs then
|
if iscvarargs then
|
||||||
p:=ctypeconvnode.create(p,voidpointertype);
|
p:=ctypeconvnode.create(p,voidpointertype);
|
||||||
objectdef :
|
objectdef :
|
||||||
if (iscvarargs and
|
if is_objc_class_or_protocol(p.resultdef) then
|
||||||
not is_objc_class_or_protocol(p.resultdef)) or
|
p:=ctypeconvnode.create(p,voidpointertype)
|
||||||
|
else if iscvarargs or
|
||||||
is_object(p.resultdef) then
|
is_object(p.resultdef) then
|
||||||
CGMessagePos1(p.fileinfo,type_e_wrong_type_in_array_constructor,p.resultdef.typename);
|
CGMessagePos1(p.fileinfo,type_e_wrong_type_in_array_constructor,p.resultdef.typename)
|
||||||
|
else
|
||||||
else
|
else
|
||||||
CGMessagePos1(p.fileinfo,type_e_wrong_type_in_array_constructor,p.resultdef.typename);
|
CGMessagePos1(p.fileinfo,type_e_wrong_type_in_array_constructor,p.resultdef.typename);
|
||||||
end;
|
end;
|
||||||
|
31
tests/test/units/cocoaall/tw36362.pp
Normal file
31
tests/test/units/cocoaall/tw36362.pp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
{$modeswitch objectivec2}
|
||||||
|
|
||||||
|
program test;
|
||||||
|
uses
|
||||||
|
CocoaAll;
|
||||||
|
|
||||||
|
type
|
||||||
|
tc = objcclass(NSObject)
|
||||||
|
a: char;
|
||||||
|
end;
|
||||||
|
|
||||||
|
operator := (const right: array of const): NSMutableArray;
|
||||||
|
begin
|
||||||
|
if tc(right[0].vPointer).a<>'a' then
|
||||||
|
halt(1);
|
||||||
|
result:=NSMutableArray.alloc.initWithCapacity(1);
|
||||||
|
result.addObject(tc(right[0].vPointer));
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
c: tc;
|
||||||
|
a: NSMutableArray;
|
||||||
|
begin
|
||||||
|
c:=tc.alloc.init;
|
||||||
|
c.a:='a';
|
||||||
|
a := [c];
|
||||||
|
for c in a do
|
||||||
|
if c.a<>'a' then
|
||||||
|
halt(2);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user