blob: 4ccb00cdb67fa8480bcbe5924084d3df84cb46e7 [file] [log] [blame]
John Kessenichdadf9452013-02-11 00:54:44 +00001#version 130
2
3float gu[];
4float g4[4];
5float g5[5];
6
7uniform int a;
8
9float[4] foo(float a[5])
10{
11 return float[](a[0], a[1], a[2], a[3]);
12}
13
14void bar(float[5]) {}
15
16void main()
17{
18 {
19 float gu[2]; // okay, new scope
20
21 gu[2] = 4.0; // ERROR, overflow
22 }
23
24 gu[2] = 4.0; // okay
25
26 gu[3] = 3.0;
27 gu[a] = 5.0; // ERROR
28
29 g4 = foo(g5);
30 g5 = g4; // ERROR
31 gu = g4; // ERROR
32
33 foo(gu); // ERROR
34 bar(g5);
35
36 if (float[4](1.0, 2.0, 3.0, 4.0) == g4)
37 gu[0] = 2.0;
38
39 float u[];
40 u[2] = 3.0; // okay
41 float u[5];
42 u[5] = 5.0; // ERROR
43 foo(u); // okay
44
45 gl_FragData[1000] = vec4(1.0); // ERROR
46 gl_FragData[-1] = vec4(1.0); // ERROR
47 gl_FragData[3] = vec4(1.0);
48
49 const int ca[] = int[](3, 2);
50 int sum = ca[0];
51 sum += ca[1];
52 sum += ca[2]; // ERROR
53
54 const int ca3[3] = int[](3, 2); // ERROR
55 int ica[] = int[](3, 2);
56 int ica3[3] = int[](3, 2); // ERROR
John Kessenichef84d102013-06-25 21:53:59 +000057 ica[3.1] = 3; // ERROR
58 ica[u[1]] = 4; // ERROR
John Kessenichdadf9452013-02-11 00:54:44 +000059}
John Kessenich34bd4fb2013-12-04 16:43:00 +000060
61int[] foo213234(); // ERROR
62int foo234234(float[]); // ERROR
63int foo234235(vec2[] v); // ERROR
John Kessenichcf0206c2014-04-14 15:46:40 +000064
65vec3 guns[];
66float f = guns[7];
67
68void foo()
69{
70 int uns[];
71 uns[3] = 40;
72 uns[1] = 30;
73 guns[2] = vec3(2.4);
74
75 float unsf[];
76 bar(unsf); // ERROR
77}
78
79float[] foo2() // ERROR
80{
81 float f[];
82 return f;
83 float g[9];
84 return g; // ERROR
85}
86
87float gUnusedUnsized[];
88
89void foo3()
90{
91 float resize1[];
92 resize1[2] = 4.0;
93 resize1.length(); // ERROR
94 float resize1[3];
95 resize1.length();
96
97 float resize2[];
98 resize2[5] = 4.0;
99 float resize2[5]; // should be ERROR, but is not
100 resize2.length();
101 resize2[5] = 4.0; // ERROR
102}
John Kessenichefb84612015-07-21 14:35:39 -0600103
John Kessenich12a38332015-07-22 11:44:59 -0600104int[] i = int[](); // ERROR, need constructor arguments
105float emptyA[];
106float b = vec4(emptyA); // ERROR, array can't be a constructor argument