Skip to content

MathUtils: declare fastATan2's Pi where its lambdas can use it - #15949

Open
ktf wants to merge 1 commit into
AliceO2Group:devfrom
ktf:pr15949
Open

ktf wants to merge 1 commit into
AliceO2Group:devfrom
ktf:pr15949

Conversation

@ktf

@ktf ktf commented Oct 12, 2026

Copy link
Copy Markdown
Member

The local constexpr T Pi sits outside the two lambdas that read it. For a builtin
T every use is an lvalue-to-rvalue conversion on a constant, so Pi is not
odr-used and needs no capture. For a class type the operator call odr-uses it,
which a lambda with no capture-default cannot do.

Capturing it would not help either, because C, Pi025 and Pi075 are constexpr and
a captured variable is not a constant expression. Declaring Pi inside each lambda
satisfies both, and costs nothing: it is folded at compile time either way.

The local constexpr T Pi sits outside the two lambdas that read it. For a builtin
T every use is an lvalue-to-rvalue conversion on a constant, so Pi is not
odr-used and needs no capture. For a class type the operator call odr-uses it,
which a lambda with no capture-default cannot do.

Capturing it would not help either, because C, Pi025 and Pi075 are constexpr and
a captured variable is not a constant expression. Declaring Pi inside each lambda
satisfies both, and costs nothing: it is folded at compile time either way.
@ktf
ktf requested a review from shahor02 as a code owner October 12, 2026 22:18
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for 81285ab at 2026-10-13 09:15:

No log files found

Full log here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants