Allow array-to-pointer conversion for rvalues.

llvm-svn: 56094
This commit is contained in:
Argyrios Kyrtzidis 2008-09-11 04:25:59 +00:00
parent 0fdbd6cf25
commit 9321c74bd0
1 changed files with 7 additions and 1 deletions

View File

@ -47,7 +47,13 @@ void Sema::DefaultFunctionArrayConversion(Expr *&E) {
// to type'...". In C99 this was changed to: C99 6.3.2.1p3: "an expression // 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" // that has type 'array of type' ...". The relevant change is "an lvalue"
// (C90) to "an expression" (C99). // (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)); ImpCastExprToType(E, Context.getArrayDecayedType(Ty));
} }
} }