summaryrefslogtreecommitdiffstats
path: root/tests/front-end/generic-disambiguate-2.slang
blob: 81fd9bc20b18a0b1865e88f35447818b0376d052 (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
//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type

static const uint X_SIZE = 32;

uint y<int x> (int y){return 0;}

uint test(uint x)
{
    uint y = 0;
    // With two stage parsing, we should be able to disambiguate this
    // from a generic function call.
    uint surround_mask = x +
        y<3?1:x>(X_SIZE) // generic call or comparison?
        ? 5 : 0;
    return surround_mask;
}

//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
RWStructuredBuffer<uint> outputBuffer;

[numthreads(1,1,1)]
void computeMain()
{
    // CHECK: 1
    outputBuffer[0] = test(1);
    // CHECK: 5
    outputBuffer[1] = test(33);
}