]> granicus.if.org Git - clang/commitdiff
Fix assertion hit in inferARCWriteback.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 1 Jul 2011 22:23:03 +0000 (22:23 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 1 Jul 2011 22:23:03 +0000 (22:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134276 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/SemaObjCXX/arc-type-conversion.mm

index 5e809b0e3557eba537867ea09e759fdb4948752e..72f88104da263eb63be98393f088bce477076925 100644 (file)
@@ -1644,8 +1644,9 @@ static void inferARCWriteback(TypeProcessingState &state,
 
     // Look for an explicit lifetime attribute there.
     DeclaratorChunk &chunk = declarator.getTypeObject(outermostPointerIndex);
-    assert(chunk.Kind == DeclaratorChunk::Pointer ||
-           chunk.Kind == DeclaratorChunk::BlockPointer);
+    if (chunk.Kind != DeclaratorChunk::Pointer &&
+        chunk.Kind != DeclaratorChunk::BlockPointer)
+      return;
     for (const AttributeList *attr = chunk.getAttrs(); attr;
            attr = attr->getNext())
       if (attr->getKind() == AttributeList::AT_objc_ownership)
index 7e2700ec6e1560f769128ecc68fa53e511d5adb2..5e7d5cc859513a0e56ae906485d7c2139f237c4f 100644 (file)
@@ -215,3 +215,6 @@ void ownership_transfer_in_cast(void *vp, Block *pblk) {
   Block_strong blk_strong2 = static_cast<Block>(blk_strong1);
   Block_autoreleasing *blk_auto = static_cast<Block*>(pblk);
 }
+
+// Make sure we don't crash.
+void writeback_test(NSString & &) {} // expected-error {{type name declared as a reference to a reference}}