Skip to content

[HLSL] Allow array to be initialized from an array of the same type #127551

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

Closed
llvm-beanz opened this issue Feb 18, 2025 · 1 comment · Fixed by #127557
Closed

[HLSL] Allow array to be initialized from an array of the same type #127551

llvm-beanz opened this issue Feb 18, 2025 · 1 comment · Fixed by #127557
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support

Comments

@llvm-beanz
Copy link
Collaborator

llvm-beanz commented Feb 18, 2025

HLSL allows a constant-sized array variable to be initialized from an array of the same type.

typedef int4 int8[2];

export void fn(int8 A) {
    int8 a = A;
}

CE

AC: the code above should compile and initialize the local array a by copying A.

@llvm-beanz llvm-beanz added the HLSL HLSL Language Support label Feb 18, 2025
llvm-beanz added a commit to llvm-beanz/llvm-project that referenced this issue Feb 18, 2025
This change allows array variables to copy-initialize from other
arrays. It also corrects a small error in HLSL C-Style casting that did
not error on casting to arrays if elementwise and splat conversions
fail.

Fixes llvm#127551
@llvm-beanz llvm-beanz moved this to Needs Review in HLSL Support Feb 18, 2025
@llvm-beanz llvm-beanz self-assigned this Feb 18, 2025
llvm-beanz added a commit that referenced this issue Feb 19, 2025
This change allows array variables to copy-initialize from other arrays.
It also corrects a small error in HLSL C-Style casting that did not
error on casting to arrays if elementwise and splat conversions fail.

Fixes #127551
@github-project-automation github-project-automation bot moved this from Needs Review to Closed in HLSL Support Feb 19, 2025
@EugeneZelenko EugeneZelenko added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Feb 19, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 19, 2025

@llvm/issue-subscribers-clang-frontend

Author: Chris B (llvm-beanz)

HLSL allows a constant-sized array variable to be initialized from an array of the same type.
typedef int4 int8[2];

export void fn(int8 A) {
    int8 a = A;
}

CE

AC: the code above should compile and initialize the local array a by copying A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support
Projects
Archived in project
3 participants