diff --git a/.gitattributes b/.gitattributes index 1efc6da511..3b37cc02be 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15193,6 +15193,7 @@ tests/webtbs/tw30329.pp -text svneol=native#text/plain tests/webtbs/tw30357.pp svneol=native#text/pascal tests/webtbs/tw3038.pp svneol=native#text/plain tests/webtbs/tw3041.pp svneol=native#text/plain +tests/webtbs/tw30443.pp svneol=native#text/plain tests/webtbs/tw3045.pp svneol=native#text/plain tests/webtbs/tw3048.pp svneol=native#text/plain tests/webtbs/tw3063.pp svneol=native#text/plain diff --git a/rtl/inc/objc1.inc b/rtl/inc/objc1.inc index 619ef8e7b2..38d6badfd9 100644 --- a/rtl/inc/objc1.inc +++ b/rtl/inc/objc1.inc @@ -166,7 +166,7 @@ type function class_respondsToSelector(cls:pobjc_class; sel:SEL):BOOL; cdecl; external libname; function class_copyMethodList(cls:pobjc_class; outCount:pdword):PMethod; cdecl; external libname; - function class_conformsToProtocol(cls:pobjc_class; var protocol: pobjc_protocol):BOOL; cdecl; external libname; + function class_conformsToProtocol(cls:pobjc_class; protocol: pobjc_protocol):BOOL; cdecl; external libname; function class_copyProtocolList(cls:pobjc_class; var outCount: dword):ppobjc_protocol; cdecl; external libname; function class_createInstance(cls:pobjc_class; extraBytes:size_t):id; cdecl; external libname; diff --git a/tests/webtbs/tw30443.pp b/tests/webtbs/tw30443.pp new file mode 100644 index 0000000000..5d9b634785 --- /dev/null +++ b/tests/webtbs/tw30443.pp @@ -0,0 +1,30 @@ +{ %target=darwin } +{ %cpu=powerpc,powerpc64,i386,x86_64,arm,aarch64 } + +{$mode objfpc}{$H+} +{$modeswitch objectivec1} + +uses + CocoaAll; + +procedure CheckProtocol; +const + NSObjectProtocolName: UTF8String = 'NSObject'; +var + nso: id; + proto: pobjc_protocol; + cls: pobjc_class; +begin + nso := NSObject.alloc.init; + cls := object_getClass(nso); + proto := objc_getProtocol(PAnsiChar(NSObjectProtocolName)); + if class_conformsToProtocol(cls, proto) then + WriteLn('NSObject implements the NSObject protocol, as expected.') + else + halt(1); + nso.release; +end; + +begin + CheckProtocol; +end.