aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-12-02 02:07:15 +0000
committerJohn McCall <rjmccall@apple.com>2010-12-02 02:07:15 +0000
commita878cda355074d7d50211be49e7871840a55a5d9 (patch)
tree19cd87a42bbf8b597049094a3f9d9bbc0198c0c3
parent70b02943ddee9ee31e9641ab3f5eb0dc874b7e03 (diff)
Perform lvalue-to-rvalue at the end of an expression statement in C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120646 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExprCXX.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index f5d7170e5c..f6bfee91ee 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -3515,6 +3515,18 @@ ExprResult Sema::ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation,
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);
}