TLIBIMP and Type Library Editor Bug: REFIIDs declared as Var (Not Const)

Both TLIBIMP and the Type Library editor have a serious bug when
processing REFIID parameters in interface methods.

Assume interface IFoo contains this method:
        HRESULT GetBar( [in] REFIID riid,
                [out, iid_is(riid)] void** ppBarObject );

The Delphi equivalent is
        function GetBar( const riid: TGUID, out ppBarObject ):
                        HResult; stdcall;

The GetBar method returns some interface for the Bar object.
Different interfaces can be requested by specifying a different
'riid'.  This is a useful way of making interface methods
polymorphic with respect to an out parameter.  The 'iid_is'
attribute tells the COM machinery that the type of the interface
passed via ppBarObject is given by the 'riid' parameter.  Without
this, you can't use a void** parameter in a COM method invocation.

IUnknown::QueryInterface is defined using this syntax - it's
pretty fundamental to COM!

So What's The Bug --

When TLIBIMP or the Type Library editor encounter a parameter
declaration like '[in] REFIID riid', they both translate it
to 'var riid: TGUID', rather than 'const riid:TGUID'.

When one tries to use the method subsequently:
        var aBarObject : IBar;
        OleCheck( aFooObject.GetBar( IBar, aBarObject ) );
Delphi complains quite properly that 'IBar' must be treated
as a const, rather than as a var.

If one then edits the declaration for GetBar to declare 'riid'
as a const TGUID, everything works great.

Note that the declaration for IUnknown (probably in COMOBJ.PAS,
but I forget..) declares QueryInterface using 'const' rather
than 'var'.

We are currently fixing this (as well as the 16-bit TOleEnum bug)
by using a SED script to postprocess PAS files generated by
TLIBIMP, but it's a pain.

Question: is a fix available for TLIBIMP and the Type Library
editor ? (We are using Delphi 3.02 currently).  If not,
when will a fix be available?

Jim Wright
IBM Computer Music Center