From c3c1b56ae693ed23804544e929a3447bc921edf6 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 2 Jun 2023 15:31:03 -0700 Subject: Fix generic param inference through TypeCastIntVal. (#2916) --- .../constants/generic-const-cast.slang | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/language-feature/constants/generic-const-cast.slang (limited to 'tests') 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 outputBuffer; + +struct G +{ + static const int r = m + 1; +} + +// CHECK: int f_0() +// CHECK: return int(3) + +int f(G 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); +} -- cgit v1.2.3