diff options
| author | Yong He <yonghe@outlook.com> | 2023-06-02 15:31:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-02 15:31:03 -0700 |
| commit | c3c1b56ae693ed23804544e929a3447bc921edf6 (patch) | |
| tree | f1d8f81a42f094729d7091cddd5622b1ff25071b /tests/language-feature | |
| parent | 16cd361dd67471bcc355d1b3b72b0b022518088f (diff) | |
Fix generic param inference through TypeCastIntVal. (#2916)
Diffstat (limited to 'tests/language-feature')
| -rw-r--r-- | tests/language-feature/constants/generic-const-cast.slang | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/language-feature/constants/generic-const-cast.slang b/tests/language-feature/constants/generic-const-cast.slang new file mode 100644 index 000000000..eb4601872 --- /dev/null +++ b/tests/language-feature/constants/generic-const-cast.slang @@ -0,0 +1,26 @@ +//TEST:SIMPLE(filecheck=CHECK): -entry computeMain -profile cs_5_0 -target hlsl + +//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +struct G<let m : uint> +{ + static const int r = m + 1; +} + +// CHECK: int f_0() +// CHECK: return int(3) + +int f<let n : int>(G<n> v) +{ + return v.r; +} +static const int c = (int8_t)255; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + G<2> g; + int tid = dispatchThreadID.x; + outputBuffer[tid] = f(g); +} |
