Commit 743edc9
committed
MathUtils: declare fastATan2's Pi where its lambdas can use it
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.1 parent 2743450 commit 743edc9
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
279 | | - | |
280 | 278 | | |
281 | 279 | | |
282 | 280 | | |
283 | 281 | | |
| 282 | + | |
284 | 283 | | |
285 | 284 | | |
286 | 285 | | |
| |||
290 | 289 | | |
291 | 290 | | |
292 | 291 | | |
| 292 | + | |
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| |||
0 commit comments