summaryrefslogtreecommitdiffstats
path: root/tests/autodiff/differential-type-syntheize-diagnostics.slang
blob: 3ca385177c6eec789a58996dd3cd62cf41c6910c (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
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target cuda -line-directive-mode none

struct PartlyDiffable : IDifferentiable
{
    no_diff float noDiffMember;
    float diffMember;
}

float func(PartlyDiffable.Differential x)
{
   // CHECK: ([[# @LINE+1]]): error 30027: 'noDiffMember' is not a member of 'PartlyDiffable.Differential'.
    return x.noDiffMember;
}

float func1(PartlyDiffable.Differential x)
{
   // CHECK-NOT: ([[# @LINE+1]]): error 30027: 'diffMember.
    return x.diffMember;
}

RWStructuredBuffer<float> out;

[shader("compute")]
void compute()
{
    // CHECK:  ([[# @LINE+1]]): error 39999: no overload for 'Differential' applicable to arguments of type (float, float)
    var diff = PartlyDiffable.Differential(1.0f, 2.0f);
    out[0] = func(diff);
    out[1] = func1(diff);
}