From d9fc7bc9b9b12e0d7c24d9159e501271161aedeb Mon Sep 17 00:00:00 2001 From: venkataram-nv Date: Mon, 9 Sep 2024 22:03:27 -0700 Subject: Add load paths to return value check (#5042) --- .../uninitialized-struct-from-constructor.slang | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/diagnostics/uninitialized-struct-from-constructor.slang (limited to 'tests') diff --git a/tests/diagnostics/uninitialized-struct-from-constructor.slang b/tests/diagnostics/uninitialized-struct-from-constructor.slang new file mode 100644 index 000000000..e3c44dca1 --- /dev/null +++ b/tests/diagnostics/uninitialized-struct-from-constructor.slang @@ -0,0 +1,24 @@ +//TEST:SIMPLE(filecheck=CHK): -target spirv + +struct TangentSpace +{ + static const float3 localNormal = {0, 1, 0}; + + float4x4 tangentTransform; + float3 geometryNormal; + + __init(in float3 normal, in float3 inRay) + { + // Should not warn here + tangentTransform = getMatrix(normal, inRay); + geometryNormal = localNormal; + } + + float4x4 getMatrix(in float3 normal, in float3 inRay) + { + return float4x4(0.0f); + } +} + +//CHK-NOT: warning 41020 +//CHK-NOT: warning 41021 \ No newline at end of file -- cgit v1.2.3