diff options
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index c96ab42b880..9267860d157 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -2260,7 +2260,15 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, break; case ICK_Lvalue_To_Rvalue: - assert(From->getObjectKind() != OK_ObjCProperty); + // Should this get its own ICK? + if (From->getObjectKind() == OK_ObjCProperty) { + ExprResult FromRes = ConvertPropertyForRValue(From); + if (FromRes.isInvalid()) + return ExprError(); + From = FromRes.take(); + if (!From->isGLValue()) break; + } + FromType = FromType.getUnqualifiedType(); From = ImplicitCastExpr::Create(Context, FromType, CK_LValueToRValue, From, 0, VK_RValue); @@ -4186,10 +4194,6 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, if (Result.isInvalid()) return ExprError(); Base = Result.get(); - Result = CheckPlaceholderExpr(Base); - if (Result.isInvalid()) return ExprError(); - Base = Result.take(); - QualType BaseType = Base->getType(); MayBePseudoDestructor = false; if (BaseType->isDependentType()) { @@ -4588,12 +4592,6 @@ ExprResult Sema::ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation, /// Perform the conversions required for an expression used in a /// context that ignores the result. ExprResult Sema::IgnoredValueConversions(Expr *E) { - if (E->hasPlaceholderType()) { - ExprResult result = CheckPlaceholderExpr(E); - if (result.isInvalid()) return Owned(E); - E = result.take(); - } - // C99 6.3.2.1: // [Except in specific positions,] an lvalue that does not have // array type is converted to the value stored in the @@ -4609,6 +4607,14 @@ ExprResult Sema::IgnoredValueConversions(Expr *E) { return Owned(E); } + // We always want to do this on ObjC property references. + if (E->getObjectKind() == OK_ObjCProperty) { + ExprResult Res = ConvertPropertyForRValue(E); + if (Res.isInvalid()) return Owned(E); + E = Res.take(); + if (E->isRValue()) return Owned(E); + } + // Otherwise, this rule does not apply in C++, at least not for the moment. if (getLangOptions().CPlusPlus) return Owned(E); |