Skip to content

Yield a zero derivative when a forward-mode call base has no tangent. - #1913

Merged
vgvassilev merged 1 commit into
masterfrom
clad-forward-nonactive
Jul 20, 2026
Merged

Yield a zero derivative when a forward-mode call base has no tangent.#1913
vgvassilev merged 1 commit into
masterfrom
clad-forward-nonactive

Conversation

@vgvassilev

Copy link
Copy Markdown
Owner

A member/operator call whose base object does not depend on the differentiation variable has no forward tangent, and so no pushforward to call. VisitCallExpr took the address of that tangent regardless: where it was void this failed with "cannot take the address of an rvalue of type 'void'", and otherwise a null argument was passed on to the pushforward.

Return a zero derivative instead, since such a call contributes nothing to the directional derivative. Type it after the call's own result rather than int, so it composes with a caller expecting the callee's type.

A member/operator call whose base object does not depend on the differentiation
variable has no forward tangent, and so no pushforward to call. VisitCallExpr
took the address of that tangent regardless: where it was void this failed with
"cannot take the address of an rvalue of type 'void'", and otherwise a null
argument was passed on to the pushforward.

Return a zero derivative instead, since such a call contributes nothing to the
directional derivative. Type it after the call's own result rather than int, so
it composes with a caller expecting the callee's type.
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@vgvassilev
vgvassilev merged commit c18a748 into master Jul 20, 2026
40 checks passed
@vgvassilev
vgvassilev deleted the clad-forward-nonactive branch July 20, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant