summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-7856.slang
blob: b1edec8b5d6c1b996b4b789c922d682590e76c55 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv -entry computeMain -stage compute

enum A
{
    V1,
    V2,
    V3
}

enum B
{
    V1,
    V2,
    V3
}

struct Foo<T, A access = A::V1, B addrSpace = B::V1>
{
    int a;
    __init(int b) { a = b; }
    __init<U, A accessOther>(Foo<U, accessOther, addrSpace> ptr)
    {
    }

    // internally Slang is throwing an error, we just don't drain the error
    // from our sink
    __init(uint64_t val) {}
    __init(int64_t val) {}
}

extension int64_t
{
    __init<T, A access, B addrSpace>(Foo<T, access, addrSpace> t) {}
}
extension uint64_t
{
    __init<T, A access, B addrSpace>(Foo<T, access, addrSpace> t) {}
}

RWStructuredBuffer<int> output;

[shader("compute")]
[numthreads(1, 1, 1)]
void computeMain(uint3 threadId: SV_DispatchThreadID)
{
    Foo<int, A.V1, B.V1> v1 = Foo<int, A.V1, B.V1>(1);

    // CHECK: ([[# @LINE+1]]): error 30080
    Foo<float, A.V1, B.V2> v2 = Foo<float, A.V1, B.V2>(v1);

    output[0] = v1.a;
}