microsoft / microsoft/DirectXShaderCompiler

Derived struct cannot be passed as `inout` parameter of base struct in function

Open
#8,087 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
In trying out a workaround to this closed issue #8083, I found that passing the derived class to an inout parameter of the base class will fail to compile. See this code.

Steps to Reproduce
Tried to compile on godbolt with -E main -T cs_6_8 -HV 202x -spirv on DXC trunk.
It should be noted that without inout, it compiles fine. See code

Actual Behavior
I would expect it to compile fine just as it does without inout specifier.

Environment

  • DXC version trunk (1.8.2505)
  • Host Operating System Windows

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.

Research direction

Open the two linked Godbolt reproducers and run the reported DXC trunk command with -E main -T cs_6_8 -HV 202x -spirv, comparing the inout and non-inout cases. Investigate the compiler path handling derived and base structs; done means the derived struct compiles when passed to the base struct's inout parameter.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.