diff options
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/stmtexpr.cpp | 10 |
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; })); +} + |