It's a known and undocumented bug that will not get fixed until it's fixed in Delphi (fpc follows Delphi to the letter including the bugs).
Never use const with ref counted interfaces.
Oh? Explain the bug, plz.... Because there isn't any.... Some people mix classes with interfaces as was initially the case here, but that is
programmer error.A const interface parameter needs to increase and decrease refcount inside a procedure or function body, that's not a bug.
It needs to have a valid reference at all times.
Furthermore: FPC behaves differently than Delphi regarding release moment inside a procedure or function body in this case.
And that is implementation detail AND is documented AND usually does not matter.
Just curious: WHY do you think it is a bug?
It isn't... Also not in other languages....that support COM interfaces....