summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp5
-rw-r--r--clang/test/Parser/objcxx11-messaging-and-lambda.mm11
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index b569e7aeba1..b0740970d88 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -739,8 +739,11 @@ ExprResult Parser::TryParseLambdaExpression() {
&& Tok.is(tok::l_square)
&& "Not at the start of a possible lambda expression.");
- const Token Next = NextToken(), After = GetLookAheadToken(2);
+ const Token Next = NextToken();
+ if (Next.is(tok::eof)) // Nothing else to lookup here...
+ return ExprEmpty();
+ const Token After = GetLookAheadToken(2);
// If lookahead indicates this is a lambda...
if (Next.is(tok::r_square) || // []
Next.is(tok::equal) || // [=
diff --git a/clang/test/Parser/objcxx11-messaging-and-lambda.mm b/clang/test/Parser/objcxx11-messaging-and-lambda.mm
new file mode 100644
index 00000000000..002f3e9c710
--- /dev/null
+++ b/clang/test/Parser/objcxx11-messaging-and-lambda.mm
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+#define OBJCLASS(name) // expected-note {{macro 'OBJCLASS' defined here}}
+
+class NSMutableData;
+
+NSMutableData *test() { // expected-note {{to match this '{'}}
+ NSMutableData *data = [[[OBJCLASS(NSMutableDataOBJCLASS( alloc] init] autorelease]; // expected-error {{unterminated function-like macro invocation}} \
+ // expected-error {{expected ';' at end of declaration}}
+ return data;
+} // expected-error {{expected expression}} expected-error {{expected '}'}}
OpenPOWER on IntegriCloud