aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-09-11 04:25:59 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-09-11 04:25:59 +0000
commitc39a3d76737cce06116145c24f9821857e214e59 (patch)
treefc287ff513d7ca3cb37ad926b8919652110513b6 /lib
parent24b41fa8239c63b9eb570d3e83c4a82840656a65 (diff)
Allow array-to-pointer conversion for rvalues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExpr.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index aa8f194e8f..032df06c72 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -47,7 +47,13 @@ void Sema::DefaultFunctionArrayConversion(Expr *&E) {
// to type'...". In C99 this was changed to: C99 6.3.2.1p3: "an expression
// that has type 'array of type' ...". The relevant change is "an lvalue"
// (C90) to "an expression" (C99).
- if (getLangOptions().C99 || E->isLvalue(Context) == Expr::LV_Valid)
+ //
+ // C++ 4.2p1:
+ // An lvalue or rvalue of type "array of N T" or "array of unknown bound of
+ // T" can be converted to an rvalue of type "pointer to T".
+ //
+ if (getLangOptions().C99 || getLangOptions().CPlusPlus ||
+ E->isLvalue(Context) == Expr::LV_Valid)
ImpCastExprToType(E, Context.getArrayDecayedType(Ty));
}
}