diff options
| author | Yong He <yonghe@outlook.com> | 2025-01-17 14:52:28 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-17 14:52:28 -0800 |
| commit | d046082c501d3501a24c143dff2cfa42939549b9 (patch) | |
| tree | ba9859ca11c7b295968005624249ee1abf5d07a9 /tests/language-feature | |
| parent | dc69d85f89e42eb2fe914e1105a8cbb68e9a8ca4 (diff) | |
Add diagnostic for function body followed by a `;`;. (#6122)
Diffstat (limited to 'tests/language-feature')
| -rw-r--r-- | tests/language-feature/empty-struct-method.slang | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/language-feature/empty-struct-method.slang b/tests/language-feature/empty-struct-method.slang new file mode 100644 index 000000000..2467013ac --- /dev/null +++ b/tests/language-feature/empty-struct-method.slang @@ -0,0 +1,37 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):-target spirv + +struct Light +{ + float3 position; + float radius; + + float3 color; + float intensity; +}; + +[vk::binding(0, 0)] +StructuredBuffer<Light> globalLightList; + +struct Lighting +{ + //CHECK: ([[# @LINE+1]]): error 20102 + float3 DoLighting(Light light); + { + // Not emitted + return float3(1.0, 1.0, 1.0); + } +}; + +[shader("fragment")] +float4 fragment(float4 color: COLOR0) +{ + float4 albedo = color; + + if (albedo.a < 0.025) + discard; + + Lighting light = Lighting(); + albedo.xyz = light.DoLighting(globalLightList[0]); + + return albedo; +}
\ No newline at end of file |
