-
Notifications
You must be signed in to change notification settings - Fork 422
Open
Description
Description
Accessing a static const member of an interface through dynamic dispatch causes an internal compiler error (ICE 99999) instead of producing a proper diagnostic or generating correct code.
Reproducer
interface ILabeled
{
static const int label;
}
struct LinOp : ILabeled
{
static const int label = 10;
}
struct QuadOp : ILabeled
{
static const int label = 20;
}
int getLabel(ILabeled op)
{
return op.label;
}Compile with:
slangc repro.slang -target hlsl -stage compute -entry computeMain
The same ICE also occurs when accessing via a generic parameter with dynamic dispatch:
int getLabel<T : ILabeled>(T op)
{
return T.label;
}Expected behavior
The compiler should either:
- Generate correct dynamic dispatch code for
static constmembers (similar to howstaticmethods are dispatched), or - Produce a clear diagnostic explaining that
static constmembers cannot be used with dynamic dispatch
Actual behavior
error 99999: unexpected IR opcode during code emit
Affects both HLSL and SPIRV targets.
Notes
staticmethods on interfaces dispatch correctly through dynamic dispatch - onlystatic constmembers are affectedstatic constin interfaces works correctly when the concrete type is known at compile time (seetests/language-feature/constants/static-const-in-interface.slang)- A disabled diagnostic test documenting this ICE was added in Add tests for static method dispatch on interface-typed values #10149
Reactions are currently unavailable