aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-01 22:23:03 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-01 22:23:03 +0000
commit1c73dcbe1f1921bad8311cfb5089d30b4bd75b66 (patch)
tree6bbcbc516962ee4af307773ea4bc16bd1f6fd1f7
parent0a85183be6930571f3af8e5a976d24c3f95e5b25 (diff)
Fix assertion hit in inferARCWriteback.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134276 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaType.cpp5
-rw-r--r--test/SemaObjCXX/arc-type-conversion.mm3
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 5e809b0e35..72f88104da 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -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)
diff --git a/test/SemaObjCXX/arc-type-conversion.mm b/test/SemaObjCXX/arc-type-conversion.mm
index 7e2700ec6e..5e7d5cc859 100644
--- a/test/SemaObjCXX/arc-type-conversion.mm
+++ b/test/SemaObjCXX/arc-type-conversion.mm
@@ -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}}