blob: 42ad84f845d3b7e0c25c734621e4df6331913cae [file] [log] [blame]
steve-lunarg26d31452016-12-23 18:56:57 -07001uniform int4 ui4;
2
3static const int cia = -4;
4static const int cib = -42;
5
6// ERROR: Ambiguous with fn1 below.
7// int4 fn1(int4 p0) { return int4(1,2,3,4); }
8
9int4 fn1(int4 p0, bool b1, bool b2 = false) {
10 return p0;
11}
12
13int4 fn1(int4 p0,
14 int4 p1 : FOO = int4(-1,-2,-3, cia),
15 int p2[2] : BAR = { int(1), 2 },
16 int p3 = abs(cib) )
17{
18 return p0 + p1 + p2[0] + p3;
19}
20
21// These should not be ambiguous if given either an int or a float explicit second parameter.
22int4 fn2(int4 p0, int x = 3)
23{
24 return int4(10,11,12,13);
25}
26
27int4 fn2(int4 p0, float x = sin(3.3)) // OK to have a const expression as a default value
28{
29 return p0 + int4(20,21,22,23);
30}
31
32void fn3(int p0 = 3) { }
33
34
35int4 main() : SV_Target0
36{
37 int myarray[2] = {30,31};
38
39 fn3();
40 fn3(5);
41
42 return fn1(100) +
43 fn1(101, ui4) +
44 fn1(102, ui4, myarray) +
45 fn1(103, ui4, myarray, 99) +
46 fn1(104, false) +
47 fn1(105, false, true) +
48
49 fn2(110, 11.11) + // calls int4, float form
50 fn2(111, 12); // calls int4, int form
51}