Internal Compiler error: cast<X>() argument of incompatible type with vector type in struct template
Description I am getting an Internal Compiler Error (ICE) with the following code: https://godbolt.org/z/Tde8anb6d
This seems to stem from the combination of using sizeof (which returns an unspeakable HLSL type, unsigned long) on a template argument, trying to provide the template argument to a vector.
The following similar examples will compile just fine:
- If I have the exact same vector declaration outside of the template context, things are fine. https://godbolt.org/z/PY7csqT4v
- If I use sizeof in the template, and do not depend on the template arg, then things are fine. https://godbolt.org/z/5zYf4bdoo
- If I cast the result of the sizeof that produces the ICE to a uint, then it compiles. https://godbolt.org/z/fP1ebzr6d
- If the type I am instantiating is not a vector, then it compiles. https://godbolt.org/z/cPfevPxhj
Steps to Reproduce Minimal steps can be found in https://godbolt.org/z/Tde8anb6d
Actual Behavior Full error output: Internal Compiler error: cast<X>() argument of incompatible type! Compiler returned: 29
Environment
- DXC version 1.7.2308.12
- Host Operating System Windows 10 Pro Version 22H2
Solution might involve making the vector template a proper template instead of the hlsl-specific implementation that's there now.
I did wonder if it was related to #4629. It is the same ICE (as in the same error output), however the steps in that issue seemed to be very different to mine, so I made a separate issue to it.