On Mon, Mar 2, 2020 at 1:57 PM leon zadorin <leonleon77@xxxxxxxxx> wrote: > > template<typename T> > void foo(T const f) > { > f(); > } ... > the effect of 'mutable' (i.e. making operator()() non-const) are not detected by GCC/clang to a point where both of the following compile ok: > int main() > { > foo([](){}); > foo([]() mutable {}); > } > ... actually never mind, I take it back :) I think GCC/clang are ok in that regard, reading https://en.cppreference.com/w/cpp/language/lambda "mutable: allows body to modify the parameters captured by copy, and to call their non-const member functions" makes it more clear for me... as in the above lambdas have no captures anyways (i.e. no effect), and with any captures (e.g. mutating with mutable) the expected compilation failure becomes evident, so in effect GCC/clang are doing this fine :) sorry for the noise everyone :) Kind regards Leon.