Skip to content

ICE 99999 when upcasting existential from derived interface to base interface #10156

@jvepsalainen-nv

Description

@jvepsalainen-nv

Upcasting an interface-typed (existential) value from a derived interface to a base interface causes an internal compiler error (ICE 99999) with the message "Unexpected context type for parameter info retrieval".

This affects both generic and non-generic interface hierarchies.

Reproduction (non-generic):

interface IBase
{
    float getValue();
}

interface IDerived : IBase
{
    float transform(float input);
}

struct Impl : IDerived
{
    float v;
    float getValue() { return v; }
    float transform(float input) { return input + v; }
}

void test()
{
    IDerived derived;
    derived = Impl(10.0);

    // This upcast triggers ICE 99999
    IBase base = derived;
    float x = base.getValue();
}

Reproduction (generic):

interface IBase<T : IArithmetic>
{
    T getValue();
}

interface IDerived<T : IArithmetic> : IBase<T>
{
    T transform(T input);
}

struct Impl : IDerived<float>
{
    float v;
    float getValue() { return v; }
    float transform(float input) { return input + v; }
}

void test()
{
    IDerived<float> derived;
    derived = Impl(10.0);

    // This upcast also triggers ICE 99999
    IBase<float> base = derived;
    float x = base.getValue();
}

Note: Using IDerived directly (without upcasting to IBase) works correctly with dynamic dispatch. The ICE occurs specifically when assigning the existential to the base interface type.

Metadata

Metadata

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions