Parse: Don't crash when trailing return type is missing
Sema::CheckParmsForFunctionDef can't cope with a null TypeSourceInfo.
Don't let the AST contain the malformed lambda.
This fixes PR22122.
llvm-svn: 225505
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp
index 8cfe7f3..4bcc60c 100644
--- a/clang/test/Parser/cxx0x-lambda-expressions.cpp
+++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp
@@ -91,3 +91,10 @@
__attribute__((noreturn)) { while(1); }; // expected-error {{expected body of lambda expression}}
}
};
+
+template <typename>
+void PR22122() {
+ [](int) -> {}; // expected-error {{expected a type}}
+}
+
+template void PR22122<int>();