Skip to content

Commit ccf72d6

Browse files
Vedant2005goyalvgvassilev
authored andcommitted
Resolves one out of two Xfail tests
1 parent 6c80b4e commit ccf72d6

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/Differentiator/HessianModeVisitor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ DerivativeAndOverload HessianModeVisitor::Derive() {
157157
std::string helperMsg("clad::hessian(" + FD->getNameAsString() +
158158
", \"" + suggestedArgsStr + "\")");
159159
SourceLocation L = PVD->getBeginLoc();
160+
if (m_DiffReq.Args)
161+
L = m_DiffReq.Args->getExprLoc();
160162
diag(DiagnosticsEngine::Error, L,
161163
"hessian mode differentiation w.r.t. array or pointer "
162164
"parameters needs explicit declaration of the indices of the "

test/Hessian/ArrayErrors.C

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
#include "clad/Differentiator/Differentiator.h"
44

5-
//XFAIL:*
6-
double f(int a, const double *b) {
5+
double f(double a, const double *b) {
76
return b[0] * a + b[1] * a + b[2] * a;
87
}
98

109
int main() {
11-
clad::hessian(f, 1); // expected-error {{hessian mode differentiation w.r.t. array or pointer parameters needs explicit declaration of the indices of the array using the args parameter; did you mean 'clad::hessian(f, "b[0:<last index of b>]")'}}
10+
clad::hessian(f, 1); // expected-error {{hessian mode differentiation w.r.t. array or pointer parameters needs explicit declaration of the indices of the array using the args parameter; did you mean 'clad::hessian}}
1211
clad::hessian(f, "a");
13-
clad::hessian(f, "a, b"); // expected-error {{hessian mode differentiation w.r.t. array or pointer parameters needs explicit declaration of the indices of the array using the args parameter; did you mean 'clad::hessian(f, "a, b[0:<last index of b>]")'}}
12+
clad::hessian(f, "a, b"); // expected-error {{hessian mode differentiation w.r.t. array or pointer parameters needs explicit declaration of the indices of the array using the args parameter; did you mean 'clad::hessian}}
1413
clad::hessian(f, "a, b[0:2]");
15-
};
14+
};

0 commit comments

Comments
 (0)