microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] vk::static_pointer_cast and vk::reinterpret_pointer_cast fail to compile
Open
@Keenuts is already working on this.
Since Dec 4, 2025.
bug
spirv
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Currently these two casting functions for buffer pointers don't seem to cast at all - they behave as if their return type is the same as the input type:
<source>:17:29: error: cannot initialize a variable of type 'BufferPointer<Base>' with an rvalue of type 'BufferPointer<Derived>'
vk::BufferPointer<Base> derivedBufAsBase = vk::static_pointer_cast<Base>(derivedBuf);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:19:30: error: cannot initialize a variable of type 'BufferPointer<float>' with an rvalue of type 'BufferPointer<int>'
vk::BufferPointer<float> intBufAsFloat = vk::reinterpret_pointer_cast<float>(intBuf);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steps to Reproduce
https://godbolt.org/z/vTos39Wcx
Environment
- DXC version: trunk
- Host Operating System: Windows 11
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.
Assessment
This issue has not been assessed yet.