Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-11

Interface usage causes FPC to crash

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I tested the attached program under Delphi 7 and FPC 2.6.0 and FPC 2.7.1 (dated 2012-11-15).

The test application tests two things:
1) Interface delegation via another class
2) Overriding a interface implementation using method resolution

Under Delphi 7 the test application compiles and runs as expected.

Under FPC (both 2.6.0 and 2.7.1)
- I get a compiler error. I thought interface delegation was supported in FPC?
- I also get a compiler crash with an AV - in both versions.

Isn't interface delegation supported in FPC?

Is method resolution supported in FPC?

Why does the compiler crash while compiling?

----8<-------------8<-------------8<-------------8<-------------8<---- Free Pascal Compiler version 2.6.0 [2011/12/23] for x86_64 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: Linux for x86-64
Compiling test.pas
test.pas(38,76) Error: Class "TMyIntfClass" does not implement interface "IMyIntf"
Fatal: Compilation aborted
An unhandled exception occurred at $000000000054CA3D : EAccessViolation : Access violation
$000000000054CA3D
$0000000000532148
$000000000056CEF4
$000000000042392F
----8<-------------8<-------------8<-------------8<-------------8<----

The expected output when running the test application should be:

---------------------------------------------------------- c:\Programming\test\interface_delegation_2>test
TMyIntfClass.P1
TMainForm.MyP2

----------------------------------------------------------

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Sergei Gorelkin
to David Ballesteros

30.11.2012 17:20, David Ballesteros пишет:

Hi, Im interested on known the answers to Graeme questions.

Delegation to interface-type properties is fully supported. Delegation to class-type properties is supported, but it requires the delegate class to implement the interface (this requirement is absent in Delphi).

Method resolution also works, but it is mutually exclusive with delegation.

The crash at compilation of course needs to be fixed.

Regards,
Sergei

Reply by email