aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-10-27 20:10:28 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-10-27 20:10:28 +0000
commit500b782d51541a5f20f3113305bc3842fba8b77a (patch)
tree720afdcfc679b33beab3a5fedf09299b62d8dfb8
parent06c919300ce39e50ed7f6dff5025c8ed96dcf221 (diff)
patch to do array-to-pointer conversion in a
statement-expression. // rdar: //8600553 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117479 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/CodeGenCXX/stmtexpr.cpp10
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index f8c7a90f8f..1f50b4e5c5 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -7072,6 +7072,8 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
}
if (Expr *LastExpr = dyn_cast<Expr>(LastStmt)) {
Ty = LastExpr->getType();
+ if (Ty->isArrayType())
+ Ty = Context.getArrayDecayedType(Ty);
if (!Ty->isDependentType() && !LastExpr->isTypeDependent()) {
ExprResult Res = PerformCopyInitialization(
InitializedEntity::InitializeResult(LPLoc,
diff --git a/test/CodeGenCXX/stmtexpr.cpp b/test/CodeGenCXX/stmtexpr.cpp
index 2b64747fa0..0828d592fe 100644
--- a/test/CodeGenCXX/stmtexpr.cpp
+++ b/test/CodeGenCXX/stmtexpr.cpp
@@ -63,3 +63,13 @@ int main()
foo4();
return foo(1).i-1;
}
+
+// rdar: // 8600553
+int a[128];
+int* foo5() {
+// CHECK-NOT: memcpy
+ // Check that array-to-pointer conversion occurs in a
+ // statement-expression.
+ return (({ a; }));
+}
+