yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Tim FoleyRemove implicit conversions to `void` (#1388)d84cfb766

master
426 B25 linesraw
1// void-function-returning-value.slang
2
3// Confirm that we diagnose a `void` function that returns a value.
4
5//DIAGNOSTIC_TEST:SIMPLE:-stage compute -entry main -target dxbc
6
7void good()
8{
9	// Explicit cast to `void` is okay.
10	return (void)1;
11}
12
13void bad()
14{
15	// Implicit cast to `void` is not allowed.
16	return 1;
17}
18
19[numthreads(1, 1, 1)]
20void main(
21    uint3 dispatchThreadID : SV_DispatchThreadID)
22{
23    good();
24    bad();
25}