Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Compiler error: cast<X>() argument of incompatible type with vector type in struct template #6228

Open
KStocky opened this issue Jan 31, 2024 · 2 comments
Labels
bug Bug, regression, crash hlsl2021 Pertaining to HLSL2021 features

Comments

@KStocky
Copy link

KStocky commented Jan 31, 2024

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:

  1. If I have the exact same vector declaration outside of the template context, things are fine. https://godbolt.org/z/PY7csqT4v
  2. If I use sizeof in the template, and do not depend on the template arg, then things are fine. https://godbolt.org/z/5zYf4bdoo
  3. If I cast the result of the sizeof that produces the ICE to a uint, then it compiles. https://godbolt.org/z/fP1ebzr6d
  4. 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
@KStocky KStocky added bug Bug, regression, crash needs-triage Awaiting triage labels Jan 31, 2024
@pow2clk pow2clk added hlsl2021 Pertaining to HLSL2021 features and removed needs-triage Awaiting triage labels Jan 31, 2024
@pow2clk
Copy link
Member

pow2clk commented Jan 31, 2024

Solution might involve making the vector template a proper template instead of the hlsl-specific implementation that's there now.

@KStocky
Copy link
Author

KStocky commented Jan 31, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash hlsl2021 Pertaining to HLSL2021 features
Projects
Status: New
Status: Triaged
Development

No branches or pull requests

3 participants
@KStocky @pow2clk and others