[cfe-commits] r120646 - /cfe/trunk/lib/Sema/SemaExprCXX.cpp
John McCall
rjmccall at apple.com
Wed Dec 1 18:07:16 PST 2010
Author: rjmccall
Date: Wed Dec 1 20:07:15 2010
New Revision: 120646
URL: http://llvm.org/viewvc/llvm-project?rev=120646&view=rev
Log:
Perform lvalue-to-rvalue at the end of an expression statement in C.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=120646&r1=120645&r2=120646&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Dec 1 20:07:15 2010
@@ -3515,6 +3515,18 @@
ExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) {
if (!FullExpr) return ExprError();
+ // 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
+ // designated object (and is no longer an lvalue).
+ // This rule does not apply in C++; however, in ObjC++, we do want
+ // to do lvalue-to-rvalue conversion on top-level ObjCProperty
+ // l-values.
+ if (!FullExpr->isRValue() &&
+ (!getLangOptions().CPlusPlus ||
+ FullExpr->getObjectKind() == OK_ObjCProperty))
+ DefaultFunctionArrayLvalueConversion(FullExpr);
+
CheckImplicitConversions(FullExpr);
return MaybeCreateCXXExprWithTemporaries(FullExpr);
}
More information about the cfe-commits
mailing list