diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-01-29 12:13:13 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-29 10:13:13 -0800 |
| commit | 605204374658fc6d7f647f9a57e9e322b8c83100 (patch) | |
| tree | b66d71c5fcb0aad275553a8a63b2425ca10593ab /tests/language-feature/initializer-lists | |
| parent | c18c4365af77fde279abed33876388961a180b3d (diff) | |
Fix the type coerce issue (#6215)
* Fix the type coerce issue
When synthesize the default ctor, if there is a base type
we will synthesize an InvokeExpr to call base type's default
ctor as well. But we should use the type of the inheritanceDecl
instead of base struct decl.
Diffstat (limited to 'tests/language-feature/initializer-lists')
| -rw-r--r-- | tests/language-feature/initializer-lists/inheritance-generic.slang | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/language-feature/initializer-lists/inheritance-generic.slang b/tests/language-feature/initializer-lists/inheritance-generic.slang new file mode 100644 index 000000000..c916178b8 --- /dev/null +++ b/tests/language-feature/initializer-lists/inheritance-generic.slang @@ -0,0 +1,26 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-shaderobj -vk +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-shaderobj + +struct Base<let ND:int> +{ + int a = 1; +} + +struct Derived<let ND:int>: Base<ND> +{ + bool x; + bool y; +} + +//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=result +RWStructuredBuffer<int> result; + +[shader("compute")] +[numthreads(1, 1, 1)] +void computeMain() +{ + Derived<3> d; + + // BUFFER: 1 + result[0] = d.a; +} |
