summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExprCXX.cpp2
-rw-r--r--test/CodeGenCXX/array-pointer-decay.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 8a352c4ee2..fde61e8856 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -927,7 +927,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
case ICK_Array_To_Pointer:
FromType = Context.getArrayDecayedType(FromType);
- ImpCastExprToType(From, FromType);
+ ImpCastExprToType(From, FromType, CastExpr::CK_ArrayToPointerDecay);
break;
case ICK_Function_To_Pointer:
diff --git a/test/CodeGenCXX/array-pointer-decay.cpp b/test/CodeGenCXX/array-pointer-decay.cpp
new file mode 100644
index 0000000000..5751b67b74
--- /dev/null
+++ b/test/CodeGenCXX/array-pointer-decay.cpp
@@ -0,0 +1,7 @@
+// RUN: clang-cc %s -emit-llvm -o -
+
+void f(const char*);
+
+void g() {
+ f("hello");
+}