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

[Feature Request] Allow non-literal constants in attributes #7081

Open
devshgraphicsprogramming opened this issue Jan 22, 2025 · 2 comments
Open
Labels
check-in-clang See if this repros in clang as well enhancement Feature suggestion
Milestone

Comments

@devshgraphicsprogramming

Is your feature request related to a problem? Please describe.

I've tried numerous times to make the [[]vk::]] attributes depend on a template parameter or some other const expression, each time I thought its a general C++/Clang limitation.

#6541

#6584

Theres a few other issues I can't find right now which also showcased attempts at putting constant expressions into attributes.

But turns out its not: https://godbolt.org/z/he94bcGfr

Describe the solution you'd like

Being able to specify attribute arguments/parameters from constexpr (static const) variables and enums.

Describe alternatives you've considered

Nothing

Additional context

None

@devshgraphicsprogramming devshgraphicsprogramming added enhancement Feature suggestion needs-triage Awaiting triage labels Jan 22, 2025
@damyanp damyanp added check-in-clang See if this repros in clang as well and removed needs-triage Awaiting triage labels Jan 22, 2025
@damyanp damyanp moved this to Triaged in HLSL Triage Jan 22, 2025
@damyanp damyanp added this to the Dormant milestone Jan 22, 2025
@pow2clk
Copy link
Member

pow2clk commented Jan 22, 2025

I'm not sure this is the link you intended to use as it demonstrates it working correctly in a C++ example. Given that there is some variability in this support, it would be useful to see which attributes are failing in the cases of interest.

@devshgraphicsprogramming
Copy link
Author

Here's an example of what I'd like to be able to do:
https://godbolt.org/z/cMc1rdqn9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
check-in-clang See if this repros in clang as well enhancement Feature suggestion
Projects
Status: Triaged
Development

No branches or pull requests

3 participants