microsoft / microsoft/DirectXShaderCompiler
Internal Compiler error: cast<X>() argument of incompatible type with vector type in struct template
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
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() argument of incompatible type! Compiler returned: 29
Environment
- DXC version 1.7.2308.12
- Host Operating System Windows 10 Pro Version 22H2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Godbolt reproduction at https://godbolt.org/z/Tde8anb6d using DXC 1.7.2308.12, then compare it with the four working variants linked in the report. Trace the compiler path responsible for the incompatible cast diagnostic and confirm that the reproduction no longer produces an internal compiler error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100