Don't complain about qualified property or ivar access when the

qualifier itself is invalid. Crasher noticed by Fariborz.

llvm-svn: 141544
This commit is contained in:
Douglas Gregor 2011-10-10 16:09:49 +00:00
parent b06fa540e8
commit bcc9539323
2 changed files with 4 additions and 2 deletions

View File

@ -1045,7 +1045,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
// Handle ivar access to Objective-C objects.
if (const ObjCObjectType *OTy = BaseType->getAs<ObjCObjectType>()) {
if (!SS.isEmpty()) {
if (!SS.isEmpty() && !SS.isInvalid()) {
Diag(SS.getRange().getBegin(), diag::err_qualified_objc_access)
<< 1 << SS.getScopeRep()
<< FixItHint::CreateRemoval(SS.getRange());
@ -1170,7 +1170,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
// Objective-C property access.
const ObjCObjectPointerType *OPT;
if (!IsArrow && (OPT = BaseType->getAs<ObjCObjectPointerType>())) {
if (!SS.isEmpty()) {
if (!SS.isEmpty() && !SS.isInvalid()) {
Diag(SS.getRange().getBegin(), diag::err_qualified_objc_access)
<< 0 << SS.getScopeRep()
<< FixItHint::CreateRemoval(SS.getRange());

View File

@ -64,4 +64,6 @@ class Forward;
void testD(D *d) {
d.Forward::property = 17; // expected-error{{property access cannot be qualified with 'Forward::'}}
d->Forward::ivar = 12; // expected-error{{ivar access cannot be qualified with 'Forward::'}}
d.D::property = 17; // expected-error{{expected a class or namespace}}
d->D::ivar = 12; // expected-error{{expected a class or namespace}}
}