Lambda scope can implicitly capture variables within its scope.
Your variables are in scope since they are local to the (main) function that defines lambda.
However, there are certain criteria in which variables can be captured using this mechanism, as indicated in [expr.prim.lambda] / 12
An lambda expression with an associated default capture that does not explicitly commit this or a variable with an automatic storage duration of [..], says to implicitly capture an object (ie this or a variable ) if the connection operator:
-odr-uses ([basic.def.odr]) object or
- means an object in a potentially-evaluated expression ([basic.def.odr]), where the encompassing full expression depends on the general parameter lambda declared within the scope of the lambda expression .
The most important part is [expr.const] /2.7 :
conditional expression e is an expression of a constant constant , if only the estimate e , [..] evaluates one of the following expressions:
the lvalue-to-rvalue ([conv.lval]) conversion, if it does not apply to:
the unstable value of gl of an integral or type enumeration, which refers to a non-volatile const object with previous initialization, is initialized with a constant expression.
So const int is the main expression of the constant, but const float is not.
Moreover, [expr.const] 1826 mentions:
A conjugated integer initialized by a constant can be used in constant expressions, but a floating-point variable const, initialized by a constant, cannot.
More in detail. Why is the const variable sometimes not required to be written to lambda?