Open KStocky opened 1 year ago
This code pattern is correct C++, but we're crashing in. A compiler explorer repro is here: https://cpp.godbolt.org/z/E5Yxj5qYv
The issue is likely caused by the way HLSL overrides the code generation for static
and global variables. We can probably fix this instance, but I think we're going to need to think about changing the language in the future to avoid these kinds of collisions.
Description As the title describes. A non-const static data member in a templated struct will fail to compile. Having a non-const static data member in a non-templated struct works just fine as demonstrated here https://shader-playground.timjones.io/86034155d4699032dcecce2b676f2f4d. And having a const static data member in a templated struct works just fine as demonstrated here https://shader-playground.timjones.io/a65880bc84396a5f9420e41956817761
Steps to Reproduce The following is a minimal example https://shader-playground.timjones.io/9cb247ff54bf1ee0c6bdaa960cb83f9d.
Actual Behavior Compiler outputs "Declaration may not be in a Comdat! i32* @"\01?Num@?$Test@$0CK@@@2HA"
Expected Behaviour I would expect this to compile
Environment