]> granicus.if.org Git - clang/commitdiff
Limit type of foreach's element and collection to be a pointer to
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 7 Jan 2008 18:14:04 +0000 (18:14 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 7 Jan 2008 18:14:04 +0000 (18:14 +0000)
objc object type.

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

Sema/Sema.cpp
test/Parser/objc-forcollection-neg-2.m

index 8f340db14e0d78be00513215bb4879f30a7ee000..b33e782077f08c311ff6da3d7ad2b269c70cd4a5 100644 (file)
@@ -33,7 +33,7 @@ bool Sema::isObjcObjectPointerType(QualType type) const {
       type->isObjcQualifiedIdType())
     return true;
   
-  while (type->isPointerType()) {
+  if (type->isPointerType()) {
     PointerType *pointerType = static_cast<PointerType*>(type.getTypePtr());
     type = pointerType->getPointeeType();
   }
index 807efd9fa71f09d3629ca08a0ddb6e0eb566f5e8..ba870aac20cdada6ba2db95b3410214a85a356fe 100644 (file)
@@ -30,7 +30,7 @@ typedef struct objc_object {
         for (id el in self) 
            ++i;
        MyList<P> ***p;
-        for (p in self) 
+        for (p in self)  // expected-error {{selector element is not of valid object type (its type is 'MyList<P> ***')}}
            ++i;
 
 }