1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
2 
3 void missing_lambda_declarator() {
4   [](){}();
5 }
6 
7 template<typename T> T get();
8 
9 void infer_void_return_type(int i) {
10   if (i > 17)
11     return []() { }();
12 
13   if (i > 11)
14     return []() { return; }();
15 
16   return [](int x) {
17     switch (x) {
18     case 0: return get<void>();
19     case 1: return;
20     }
21   }(7);
22 }
23 
24 struct X { };
25 
26 X infer_X_return_type(X x) {
27   return [&x](int y) { // expected-warning{{omitted result type}}
28     if (y > 0)
29       return X();
30     else
31       return x;
32   }(5);
33 }
34 
35 X infer_X_return_type_fail(X x) {
36   return [x](int y) { // expected-warning{{omitted result type}}
37     if (y > 0)
38       return X();
39     else // FIXME: shouldn't mention blocks
40       return x; // expected-error{{return type 'const X' must match previous return type 'X' when block literal has unspecified explicit return type}}
41   }(5);
42 }
43