[SPIR-V] `CXXUnresolvedConstructExpr` / Compiler crash when trying to create partially specialized structs with const static member fields
Since there's no consteval in HLSL, the next best thing to procedurally generate constants at compile-time is recursively-defined structs with const static member fields. When trying to write these, however, I ran into this: https://godbolt.org/z/v5bfqn1o3 .
Here's a smaller repro of the issue: https://godbolt.org/z/rxnqdGhMz . The line const static T value = 1; is causing the compiler to abort, throwing "isa<> used on a null pointer". Changing that to const static T value = T(1); instead throws error: expression class 'CXXUnresolvedConstructExpr' unimplemented .
Here's the workaround Matt came up with: https://godbolt.org/z/TdYs6z7qx . As showcased, the issue only happens when trying to define a generic const static member field on a partially specialized struct
Also, works just fine when targeting DXIL. The problem only happens when compiling SPIR-V