Date
2014-07-03.16:02:53
Message id
147

Content

It has been reported that various people have noticed that it's possible to write


auto lambda = []{};

but not


auto lambda2 = [] mutable {};

In the mutable case, parentheses are required, thus:


auto lambda3 = []() mutable {};

The proposed consistency fix is to change the grammar to allow omitting the parentheses for mutable lambdas as well.

An additional question EWG needs to decide is whether the empty parentheses could be omitted for other cases besides mutable, such as


[] -> float {return 42;};
[] noexcept {foo();};