I had this lambda somewhere in my code:
[](bool a, bool=true){ return !a;} }
and GCC 4.6 \"complained\" with this warning:
warn
Since C++14 it is allowed. It was found to be a defect long time ago: Default arguments for lambdas, and also Default arguments in lambda-expressions.
It makes no sense to have a default argument in a lambda function -- how could it ever be used? On the other hand, it does no harm, so why not allow it, after emitting a warning?
Section 5.1.2 paragraph 5 specifically says that you can not have default values for the parameters.
Default arguments (8.3.6) shall not be specified in the parameter-declaration-clause of a lambda-declarator.