1uniform half4 colorRed, colorGreen; 2 3struct S { 4 int a, b, c; 5}; 6 7void check_array_1(int[1]) {} 8void check_array_2(int[2]) {} 9void check_array_3(int[3]) {} 10 11bool test() { 12 const S x = S(1, 2, 3); 13 const S xx = S(1, 2, 3); 14 const S y = S(1, 2, 4); 15 16 int a[x.a]; 17 int b[x.b]; 18 int c[x.c]; 19 check_array_1(a); 20 check_array_2(b); 21 check_array_3(c); 22 23 // Structs with elements lacking side-effects can be optimized. 24 int two = 2; 25 int flatten0 = S(x.a, two, 3).a; 26 int flatten1 = S(x.a, two, 3).b; 27 int flatten2 = S(x.a, two, 3).c; 28 29 return (x == xx) && !(x != xx) && (x != y) && !(x == y) && (x.a == y.a) && 30 (flatten0 == x.a) && (flatten1 == x.b) && (flatten2 == x.c); 31} 32 33half4 main(float2 coords) { 34 return test() ? colorGreen : colorRed; 35} 36