Hello, many thanks for your reply! -vh didn't show more info, but I was able to reduce the source to a small program, maybe you can try it? Compiling it with -CR fails, but without it compiles fine without warnings. Unfortunately there are many typecasts like these and I don't know how to solve it. Best wishes, Tobias Giesen
----------------- program AnInterfaceTest; uses Classes; type {** Replacement for generic interface type. } IZInterface = IUnknown; {** Represents an interface for all abstract object. } IZObject = interface(IZInterface) ['{EF46E5F7-00CF-4DDA-BED0-057D6686AEE0}'] function Clone: IZInterface; end; {** Represents an interface to clone objects. } IZClonnable = interface(IZObject) ['{ECB7F3A4-7B2E-4130-BA66-54A2D43C0149}'] end; {** Represents a collection of object interfaces. } IZCollection = interface(IZClonnable) ['{51417C87-F992-4CAD-BC53-CF3925DD6E4C}'] end; {** Represents a hash map interface. } IZHashMap = interface(IZClonnable) ['{782C64F4-AD09-4F56-AF2B-E4193A05BBCE}'] end; {** Implements an abstract interfaced object. } { TZAbstractObject } TZAbstractObject = class(TInterfacedObject, IZObject) public function Clone: IZInterface; virtual; end; { TZHashMap } TZHashMap = class(TZAbstractObject, IZHashMap, IZClonnable) private FKeys: IZCollection; public constructor Create; destructor Destroy; override; function Clone: IZInterface; override; end; { TZAbstractObject } function TZAbstractObject.Clone: IZInterface; begin result := nil; // needs to be overriden end; { TZHashMap } constructor TZHashMap.Create; begin end; destructor TZHashMap.Destroy; begin inherited Destroy; end; function TZHashMap.Clone: IZInterface; var HashMap: TZHashMap; begin HashMap := TZHashMap.Create; HashMap.FKeys := IZCollection(FKeys.Clone); Result := HashMap; end; begin end. ----------------- Kind Regards, Tobias Giesen ---- On Mon, 4 Jul 2016 22:55:19 +0200 Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > On 04/07/16 19:38, tobiasgie...@gmail.com wrote: > > I would like to use "Verify Method Calls" (-CR), but when I choose it in > > the Lazarus > > project options under debugging, I get compiler errors such as: > > > > Incompatible type for arg no.2: Got "Class Of IZCollection", expected > > "TClass". > > > > With Verify Method Calls off, the same code compiles fine. > > > > The offending line is from ZEOS lib, ZCollections.pas: > > > > HashMap.FKeys := IZCollection(FKeys.Clone); > > > > I wonder why it says "arg no.2". > > Try compiling with -vh, it may show more info. -CR basically turns all > object/class typecasts into "as"-like expressions, but in a way that you can > still pass them to var/out-parameters. > > > Is it possible to turn "Verify Method Calls" off via a {$xxx } switch in the > > source code? > > No. > > > Jonas > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal Kind Regards, Tobias Giesen Super Flexible Software Ltd. & Co. KG Buddenstr. 29-31 48143 Münster, Germany www.superflexible.com www.tgtools.com ----------------------------------------------------------- Registered at register court Münster as HRA 9716 Liability / general partner: TGTools Ltd. Company No. 05513299 Registered in England and Wales Directors: Tobias Giesen and Claudia Giesen _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal