follows objective's semantics and is not overload'able
with an assignment operator. Fixes a crash and a missing
diagnostics. Radar
8379892.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113555
91177308-0d34-0410-b5e6-
96231b3b80d8
// Records with any const fields (recursively) are not modifiable.
if (const RecordType *R = CT->getAs<RecordType>()) {
- assert(!Ctx.getLangOptions().CPlusPlus &&
+ assert((isa<ObjCImplicitSetterGetterRefExpr>(E) ||
+ !Ctx.getLangOptions().CPlusPlus) &&
"C++ struct assignment should be resolved by the "
"copy assignment operator.");
if (R->hasConstFields())
BinaryOperatorKind Opc,
Expr *lhs, Expr *rhs) {
if (getLangOptions().CPlusPlus &&
+ (!isa<ObjCImplicitSetterGetterRefExpr>(lhs) ||
+ rhs->isTypeDependent()) &&
(lhs->getType()->isOverloadableType() ||
rhs->getType()->isOverloadableType())) {
// Find all of the overloaded operators visible from this
return 0;
}
+// rdar://8379892
+// CHECK: define void @_Z1fP1A
+// CHECK: @objc_msgSend to void
+struct X {
+ X();
+ X(const X&);
+ ~X();
+};
+
+@interface A {
+ X xval;
+}
+- (X)x;
+- (void)setX:(X)x;
+@end
+
+void f(A* a) {
+ a.x = X();
+}
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: // 8379892
+
+struct X {
+ X();
+ X(const X&);
+ ~X();
+};
+
+@interface A {
+ X xval;
+}
+
+- (X)x;
+- (void)setx:(X)x;
+@end
+
+void f(A* a) {
+ a.x = X(); // expected-error {{setter method is needed to assign to object using property assignment syntax}}
+}
+