Diagnose miuse of property dot-syntax instead of crashing.

(radar 7634653).

llvm-svn: 99210
This commit is contained in:
Fariborz Jahanian 2010-03-22 21:02:34 +00:00
parent e783d10bc0
commit cf711fb353
3 changed files with 10 additions and 1 deletions

View File

@ -2332,6 +2332,7 @@ def warn_unused_call : Warning<
def err_incomplete_type_used_in_type_trait_expr : Error<
"incomplete type %0 used in type trait expression">;
def err_expected_ident_or_lparen : Error<"expected identifier or '('">;
// inline asm.
def err_asm_wide_character : Error<"wide string is invalid in 'asm'">;

View File

@ -289,7 +289,10 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr(
IdentifierInfo *receiverNamePtr = &receiverName;
ObjCInterfaceDecl *IFace = getObjCInterfaceDecl(receiverNamePtr);
if (!IFace) {
Diag(receiverNameLoc, diag::err_expected_ident_or_lparen);
return ExprError();
}
// Search for a declared property first.
Selector Sel = PP.getSelectorTable().getNullarySelector(&propertyName);

View File

@ -16,3 +16,8 @@ int main() {
&object.index; // expected-error {{address of property expression requested}}
return 0;
}
typedef int Foo;
void test() {
Foo.x; // expected-error {{expected identifier or '('}}
}