blob: c345826e7a83374117ece436ea059e78ce628de8 (
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
|
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
[Differentiable]
float f(__constref float3 val)
{
return val.x;
}
struct MyType : IDifferentiable
{
// Error: cannot use constref on a differentiable member method of a differentiable type.
[Differentiable]
[constref] float compute(float x) { return 0; }
// OK
[Differentiable]
float compute1(float x) { return 0; }
// OK
[constref] float compute2(float x) { return 0;}
}
struct MyType2
{
// OK.
[Differentiable]
[constref] float compute(float x) { return 0; }
// OK
[constref]
float compute1(float x) { return 0; }
}
// CHECK-DAG: {{.*}}(5): error 38034: cannot use '__constref' on a differentiable parameter.
// CHECK-NOT {{.*}}error
// CHECK-DAG: {{.*}}(14): error 38034: cannot use '[constref]' on a differentiable member method of a differentiable type.
// CHECK-NOT {{.*}}error
|