Merge remote-tracking branch 'origin/swift-3.1-branch' into stable
* origin/swift-3.1-branch:
[ARC] Ignore qualifiers in copy-restore expressions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index fdd83ea..bc67d2b 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -3270,7 +3270,7 @@
if (const ObjCIndirectCopyRestoreExpr *CRE
= dyn_cast<ObjCIndirectCopyRestoreExpr>(E)) {
assert(getLangOpts().ObjCAutoRefCount);
- assert(getContext().hasSameType(E->getType(), type));
+ assert(getContext().hasSameUnqualifiedType(E->getType(), type));
return emitWritebackArg(*this, args, CRE);
}
diff --git a/test/CodeGenObjC/unqual-copy-restore.m b/test/CodeGenObjC/unqual-copy-restore.m
new file mode 100644
index 0000000..09915f7
--- /dev/null
+++ b/test/CodeGenObjC/unqual-copy-restore.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -fobjc-arc -S -emit-llvm -o /dev/null
+
+// rdar://problem/28488427 - Don't crash if the argument type and the parameter
+// type in an indirect copy restore expression have different qualification.
+@protocol P1
+@end
+
+typedef int handler(id<P1> *const p);
+
+int main() {
+ id<P1> i1 = 0;
+ handler *func = 0;
+ return func(&i1);
+}