summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/void-function-returning-value.slang
blob: 558e37dbc67075a1cb677d8abb3a22676033edc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// void-function-returning-value.slang

// Confirm that we diagnose a `void` function that returns a value.

//DIAGNOSTIC_TEST:SIMPLE:-stage compute -entry main -target dxbc

void good()
{
	// Explicit cast to `void` is okay.
	return (void)1;
}

void bad()
{
	// Implicit cast to `void` is not allowed.
	return 1;
}

[numthreads(1, 1, 1)]
void main(
    uint3 dispatchThreadID : SV_DispatchThreadID)
{
    good();
    bad();
}