summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/interfaces/static-method-not-implemented.slang
blob: 1d46c1be6ad7e809277dbfbb01523186fa2e7c1c (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
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv

interface Base
{
    static int getValue();
}

struct Impl : Base
{
    // This is not static and not allowed to implement the interface's static method.
    // CHECK: error 38105: member 'getValue' does not match interface requirement
    int getValue() { return 5; }
}

int callGet<Foo : Base>()
{
    return Foo::getValue();
}

RWStructuredBuffer<int> result;

[numthreads(1, 1, 1)]
void computeMain()
{
    result[0] = callGet<Impl>();
}