diff options
-rw-r--r-- | include/clang/AST/Expr.h | 5 | ||||
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 1 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 0c884d88b7..fed58ba22b 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -1181,7 +1181,10 @@ public: CK_Dynamic, /// CK_ToUnion - Cast to union (GCC extension). - CK_ToUnion + CK_ToUnion, + + /// CK_ArrayToPointerDecay - Array to pointer decay. + CK_ArrayToPointerDecay }; private: diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 0f8d38e6d2..3a9ec7ef6f 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -595,6 +595,7 @@ Value *ScalarExprEmitter::VisitImplicitCastExpr(const ImplicitCastExpr *E) { // If this is due to array->pointer conversion, emit the array expression as // an l-value. if (Op->getType()->isArrayType()) { + assert(E->getCastKind() == CastExpr::CK_ArrayToPointerDecay); Value *V = EmitLValue(Op).getAddress(); // Bitfields can't be arrays. // Note that VLA pointers are always decayed, so we don't need to do diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 6f75b59c30..5d9b69c844 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -209,7 +209,8 @@ void Sema::DefaultFunctionArrayConversion(Expr *&E) { // if (getLangOptions().C99 || getLangOptions().CPlusPlus || E->isLvalue(Context) == Expr::LV_Valid) - ImpCastExprToType(E, Context.getArrayDecayedType(Ty)); + ImpCastExprToType(E, Context.getArrayDecayedType(Ty), + CastExpr::CK_ArrayToPointerDecay); } } |