[cfe-commits] r56094 - /cfe/trunk/lib/Sema/SemaExpr.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Wed Sep 10 21:25:59 PDT 2008
Author: akirtzidis
Date: Wed Sep 10 23:25:59 2008
New Revision: 56094
URL: http://llvm.org/viewvc/llvm-project?rev=56094&view=rev
Log:
Allow array-to-pointer conversion for rvalues.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=56094&r1=56093&r2=56094&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Sep 10 23:25:59 2008
@@ -47,7 +47,13 @@
// 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));
}
}
More information about the cfe-commits
mailing list