]> granicus.if.org Git - clang/commitdiff
Don't complain about qualified property or ivar access when the
authorDouglas Gregor <dgregor@apple.com>
Mon, 10 Oct 2011 16:09:49 +0000 (16:09 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 10 Oct 2011 16:09:49 +0000 (16:09 +0000)
qualifier itself is invalid. Crasher noticed by Fariborz.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141544 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprMember.cpp
test/SemaObjCXX/propert-dot-error.mm

index 5b37a6f02285dd28cad7be89cbdd4072a8b6061c..918d28ff40244f89acdf10687feac2077edad9ec 100644 (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());
index b07c7e8cc2d9324bc75245fc441cfa286fa587ce..747efeb536b40cc56bc18a1e26b0fd155adeb251 100644 (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}}
 }