blob: bbd6a07c01ca04f727232703853753369c72fbf9 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// variable-redeclaration.slang
//DIAGNOSTIC_TEST:SIMPLE:
// This test confirms that the compiler produces
// suitable diagnostics when variables are redeclared
// in a given scope.
// Global variables, including shader parameters
static int gA;
static Texture2D gA;
// Local variables
int testLocalRedeclaration(int x)
{
int y = x;
int y = x;
}
int testLocalShadowing(int x)
{
int y = x;
{
// Because this declaration is in an inner
// scope it should shadow the existing `y`
// rather than conflcit with it.
//
// TODO: It would be reasonable for the
// compiler to warn on this sort of code.
//
int y = x;
}
}
// Structure fields
struct S
{
int f;
float f;
}
// Function parameter list
int testParameterRedeclaration(
int size,
float size)
{
return size;
}
|