1uniform float u;
2
3const float c = 1;
4      float f = 1;
5
6struct S { float f; } s;
7
8// Valid constant-expression initializers. Should not produce errors:
9void from_literal()           { const float x = 0; }
10void from_const_global()      { const float x = c; }
11void from_const_local()       { const float x = 0; const float y = x; }
12void from_const_constructor() { const int i = int(c); }
13void from_expression()        { const float x = 2 * c; }
14
15// Invalid constant-expression initializers. Should all produce errors:
16void from_uniform()                      { const float x = u; }
17void from_parameter(float p)             { const float x = p; }
18void from_const_parameter(const float p) { const float x = p; }
19void from_non_const_local()              { float x = u; const float y = x; }
20void from_non_const_expression()         { const float x = u + u; }
21void from_mixed_expression()             { const float x = c + u; }
22void from_non_const_struct_field()       { const float x = s.f; }
23