summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/local-used-before-declared.slang
blob: bd17666b664eadf347f5d0cd13dee84d97bc908d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//DIAGNOSTIC_TEST:SIMPLE:-target dxbc -profile ps_5_0 -entry main

// Early versions of the front-end had bugs when local
// variables were used before their definition, or
// were defined using a reference to themselves.
//
// This file tries to ensure that we emit proper error
// diagnostics in these cases.

void usedBeforeDeclared()
{
    // b is used before it is declared
	float c = d + 1.0;
	int d = 0;
}

float4 main()
{
	usedBeforeDeclared();
	return 0;
}