summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/methods/mutating-method-on-rvalue.slang
blob: ab51244aa41513f48532a97d336a5e1379aa2b80 (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
// mutating-method-on-rvalue.slang

//DIAGNOSTIC_TEST:SIMPLE:-target hlsl -entry main

struct Counter
{
    int count;

    [mutating] void increment() { count++; }

    void bad()
    {
        increment();
    }
}

cbuffer C
{
    Counter gCounter;
}

[shader("compute")]
void main()
{
    gCounter.increment();
}