From 8a15efb37a33d3c2943be87a19cbf9b5e2e8432b Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:36:29 -0700 Subject: Drain sink when single-argument constructor call fail (#7883) * fix bug * fix test * push test changs for clarity * fix bug * fix test * push test changs for clarity * test what fails * remove redundant code --- tests/bugs/gh-7856.slang | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/bugs/gh-7856.slang (limited to 'tests/bugs') diff --git a/tests/bugs/gh-7856.slang b/tests/bugs/gh-7856.slang new file mode 100644 index 000000000..b1edec8b5 --- /dev/null +++ b/tests/bugs/gh-7856.slang @@ -0,0 +1,52 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv -entry computeMain -stage compute + +enum A +{ + V1, + V2, + V3 +} + +enum B +{ + V1, + V2, + V3 +} + +struct Foo +{ + int a; + __init(int b) { a = b; } + __init(Foo ptr) + { + } + + // internally Slang is throwing an error, we just don't drain the error + // from our sink + __init(uint64_t val) {} + __init(int64_t val) {} +} + +extension int64_t +{ + __init(Foo t) {} +} +extension uint64_t +{ + __init(Foo t) {} +} + +RWStructuredBuffer output; + +[shader("compute")] +[numthreads(1, 1, 1)] +void computeMain(uint3 threadId: SV_DispatchThreadID) +{ + Foo v1 = Foo(1); + + // CHECK: ([[# @LINE+1]]): error 30080 + Foo v2 = Foo(v1); + + output[0] = v1.a; +} -- cgit v1.2.3