1 // RUN: %clang_cc1 -std=c++11 %s -Wunused -verify
2
f2()3 void f2() {
4 int i = 1;
5 void g1(int = ([i]{ return i; })()); // expected-error{{lambda expression in default argument cannot capture any entity}}
6 void g2(int = ([i]{ return 0; })()); // expected-error{{lambda expression in default argument cannot capture any entity}}
7 void g3(int = ([=]{ return i; })()); // expected-error{{lambda expression in default argument cannot capture any entity}}
8 void g4(int = ([=]{ return 0; })());
9 void g5(int = ([]{ return sizeof i; })());
10 }
11
12 namespace lambda_in_default_args {
__anon6fe65f270602() 13 int f(int = [] () -> int { int n; return ++n; } ());
__anon6fe65f270702() 14 template<typename T> T g(T = [] () -> T { T n; return ++n; } ());
15 int k = f() + g<int>();
16 }
17