microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] vk::static_pointer_cast and vk::reinterpret_pointer_cast fail to compile

Open
#7,891 3 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.