diff options
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 2 | ||||
-rw-r--r-- | test/SemaObjCXX/message.mm | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index e04e62bcb2..2785f1b14d 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -671,7 +671,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // If we have an Objective-C class name followed by an identifier and // either ':' or ']', this is an Objective-C class message send that's // missing the opening '['. Recovery appropriately. - if (getLang().ObjC1 && Tok.is(tok::identifier)) { + if (getLang().ObjC1 && Tok.is(tok::identifier) && !InMessageExpression) { const Token& Next = NextToken(); if (Next.is(tok::colon) || Next.is(tok::r_square)) if (ParsedType Typ = Actions.getTypeName(II, ILoc, getCurScope())) diff --git a/test/SemaObjCXX/message.mm b/test/SemaObjCXX/message.mm index ab86d9437f..fce546304f 100644 --- a/test/SemaObjCXX/message.mm +++ b/test/SemaObjCXX/message.mm @@ -92,3 +92,23 @@ void test_I5(I5 *i5, String s) { [i5 method:"hello" other:s]; [i5 method:s other:"world"]; // expected-error{{non-const lvalue reference to type 'String' cannot bind to a value of unrelated type 'const char [6]'}} } + +// <rdar://problem/8483253> +@interface A + +struct X { }; + ++ (A *)create:(void (*)(void *x, X r, void *data))callback + callbackData:(void *)callback_data; + +@end + + +void foo(void) +{ + void *fun; + void *ptr; + X r; + A *im = [A create:(void (*)(void *cgl_ctx, X r, void *data)) fun + callbackData:ptr]; +} |