1 // { dg-do run { target c++11 } } 2 3 #include <cassert> 4 5 template<typename F> call(const F & f)6void call(const F& f) { f(); } 7 main()8int main() { 9 call([] () -> void {}); 10 //call([] () mutable -> void {}); // { dg-error: "`f' does not have const `operator()'" } 11 12 int i = -1; 13 call([&i] () -> void { i = 0; }); 14 assert(i == 0); 15 //call([i] () -> void { i = 0; }); // { dg-error: "assignment to non-reference capture in const lambda" } 16 17 return 0; 18 } 19 20