!SuppressQualifierCheck &&
CheckQualifiedMemberReference(BaseExpr, BaseType, SS, R))
return ExprError();
+
+ // Perform a property load on the base regardless of whether we
+ // actually need it for the declaration.
+ if (BaseExpr && BaseExpr->getObjectKind() == OK_ObjCProperty) {
+ ExprResult Result = ConvertPropertyForRValue(BaseExpr);
+ if (Result.isInvalid())
+ return ExprError();
+ BaseExpr = Result.take();
+ }
// Construct an unresolved result if we in fact got an unresolved
// result.
return ExprError();
}
- // Perform a property load on the base regardless of whether we
- // actually need it for the declaration.
- if (BaseExpr->getObjectKind() == OK_ObjCProperty) {
- ExprResult Result = ConvertPropertyForRValue(BaseExpr);
- if (Result.isInvalid())
- return ExprError();
- BaseExpr = Result.take();
- }
-
if (FieldDecl *FD = dyn_cast<FieldDecl>(MemberDecl))
return BuildFieldReferenceExpr(*this, BaseExpr, IsArrow,
SS, FD, FoundDecl, MemberNameInfo);
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// rdar://10153365
+
+static int gint;
+struct SetSection {
+ int & at(int __n) { return gint; }
+ const int& at(int __n) const { return gint; }
+};
+
+static SetSection gSetSection;
+
+@interface SetShow
+- (SetSection&)sections;
+@end
+
+@implementation SetShow
+- (SetSection&) sections {
+// [self sections].at(100);
+ self.sections.at(100);
+ return gSetSection;
+}
+@end
+
+// CHECK: [[SELF:%.*]] = alloca [[T6:%.*]]*, align
+// CHECK: [[T0:%.*]] = load {{.*}}* [[SELF]], align
+// CHECK: [[T1:%.*]] = load {{.*}}* @"\01L_OBJC_SELECTOR_REFERENCES_"
+// CHECK: [[C:%.*]] = call %struct.SetSection* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK: call i32* @_ZN10SetSection2atEi(%struct.SetSection* [[C]]