LV_IncompleteVoidType,
LV_DuplicateVectorComponents,
LV_InvalidExpression,
- LV_MemberFunction
+ LV_MemberFunction,
+ LV_SubObjCPropertySetting
};
isLvalueResult isLvalue(ASTContext &Ctx) const;
MLV_NotBlockQualified,
MLV_ReadonlyProperty,
MLV_NoSetterProperty,
- MLV_MemberFunction
+ MLV_MemberFunction,
+ MLV_SubObjCPropertySetting
};
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx,
SourceLocation *Loc = 0) const;
"ISO C does not support '~' for complex conjugation of %0">;
def error_nosetter_property_assignment : Error<
"setter method is needed to assign to object using property" " assignment syntax">;
+def error_no_subobject_property_setting : Error<
+ "cannot assign to a sub-structure of an ivar using property" " assignment syntax">;
def ext_freestanding_complex : Extension<
"complex numbers are an extension in a freestanding C99 implementation">;
// -- If E2 is a non-static data member [...]. If E1 is an
// lvalue, then E1.E2 is an lvalue.
- if (isa<FieldDecl>(Member))
- return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
+ if (isa<FieldDecl>(Member)) {
+ if (m->isArrow())
+ return LV_Valid;
+ Expr *BaseExp = m->getBase();
+ return (BaseExp->getStmtClass() == ObjCPropertyRefExprClass) ?
+ LV_SubObjCPropertySetting : BaseExp->isLvalue(Ctx);
+ }
// -- If it refers to a static member function [...], then
// E1.E2 is an lvalue.
// Not an lvalue.
return LV_InvalidExpression;
}
-
+
// C99 6.5.2.3p4
- return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
+ if (m->isArrow())
+ return LV_Valid;
+ Expr *BaseExp = m->getBase();
+ return (BaseExp->getStmtClass() == ObjCPropertyRefExprClass) ?
+ LV_SubObjCPropertySetting : BaseExp->isLvalue(Ctx);
}
case UnaryOperatorClass:
if (cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Deref)
}
return MLV_InvalidExpression;
case LV_MemberFunction: return MLV_MemberFunction;
+ case LV_SubObjCPropertySetting: return MLV_SubObjCPropertySetting;
}
// The following is illegal:
case Expr::MLV_NoSetterProperty:
Diag = diag::error_nosetter_property_assignment;
break;
+ case Expr::MLV_SubObjCPropertySetting:
+ Diag = diag::error_no_subobject_property_setting;
+ break;
}
SourceRange Assign;
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef struct NSSize {
+ int width;
+ struct {
+ int dim;
+ } inner;
+} NSSize;
+
+@interface Foo {
+ NSSize _size;
+}
+@property NSSize size;
+@end
+
+void foo() {
+ Foo *f;
+ f.size.width = 2.2; // expected-error {{cannot assign to a sub-structure of an ivar using property assignment syntax}}
+ f.size.inner.dim = 200; // expected-error {{cannot assign to a sub-structure of an ivar using property assignment syntax}}
+}