Home | History | Annotate | Download | only in expr.prim.lambda
      1 // RUN: %clang_cc1 -std=c++11 %s -Wunused -verify
      2 
      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 {
     13   int f(int = [] () -> int { int n; return ++n; } ());
     14   template<typename T> T g(T = [] () -> T { T n; return ++n; } ());
     15   int k = f() + g<int>();
     16 }
     17