diff options
| author | Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> | 2023-09-07 20:04:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-07 17:04:41 -0700 |
| commit | 5d078d962e124e24ac7877cb29131dab794d7df9 (patch) | |
| tree | 24a70c53278b3f42c5bfdec6852a89a5ff26a12d /tests/diagnostics | |
| parent | 818f07558c44c3b7f5618460d20c1374df2f1262 (diff) | |
Fix compiler crashing when `[BackwardDerivativeOf(fn)]` refers to an unresolved `fn` (#3191)
* Fix compiler crashing on unresolved decl-ref
* Update autodiff-custom-diff-unresolved.slang
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/autodiff-custom-diff-unresolved.slang | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/diagnostics/autodiff-custom-diff-unresolved.slang b/tests/diagnostics/autodiff-custom-diff-unresolved.slang new file mode 100644 index 000000000..0ca055b59 --- /dev/null +++ b/tests/diagnostics/autodiff-custom-diff-unresolved.slang @@ -0,0 +1,23 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): + +// Simple check to see that the compiler returns an error message if the +// custom derivative definition points to an undefined function. +// + +void __d_f(float x, float.Differential dout) +{ +} + +[BackwardDerivative(__d_g)] +float f(float x) +{ + // CHECK: tests/diagnostics/autodiff-custom-diff-unresolved.slang([[@LINE-3]]): error 30015: undefined identifier '__d_g'. + // CHECK-NEXT: [BackwardDerivative(__d_g)] + return x * x; +} + +float main(float x) +{ + DifferentialPair<float> dpx = diffPair(x, 1.f); + bwd_diff(f)(dpx, 1.f); +}
\ No newline at end of file |
