aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/SemaObjCXX/references.mm7
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index b2f1a356df..6f971b116d 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -6313,6 +6313,8 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {
}
// If the operand has type "type", the result has type "pointer to type".
+ if (op->getType()->isObjCObjectType())
+ return Context.getObjCObjectPointerType(op->getType());
return Context.getPointerType(op->getType());
}
diff --git a/test/SemaObjCXX/references.mm b/test/SemaObjCXX/references.mm
index 70ce8278e8..9eceeaf19f 100644
--- a/test/SemaObjCXX/references.mm
+++ b/test/SemaObjCXX/references.mm
@@ -24,3 +24,10 @@ int f2(A *a) {
return f0(a.p1); // expected-error {{property 'p1' not found on object of type 'A *'}}
}
+// PR7740
+@class NSString;
+
+void f3(id);
+void f4(NSString &tmpstr) {
+ f3(&tmpstr);
+}