Open MihailMihov opened 4 months ago
Don't we need to just pass the 4 arguments instead of 3?
from my limited experience of working with operator differentiation in lambda functions, this error typically means that the constructed list of arguments for the pullback is ill-formed. the pullbacks normally accept a pointer to the derivative object of the class. I assume this may not be the case for non-differentiable types, which may result into this mismatch (if the VisitCallExpr method doesn't realise that we don't have to pass any pointers to the derivative objects to the pullback, it's gonna add this argument to the list). from what I also understand, clang does not count the first invisible argument, which is the object that calls the method itself, so in the AST it probably expects 4 args and receives 5 actually (if I remember correctly). not sure if it's exactly the case, but maybe that helps. it's only my assumption though and maybe you've already checked all of this and realised the issue
Test:
Clang invocation:
Error:
The
operator_plus_pullback
that Clad is generating is:I don't understand what the error here is, so I'm not sure how to go about fixing this, but I discovered this when creating tests for
[[clad::non_differentiable]]
in reverse mode and this error is now blocking that PR.