diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-01-17 22:50:08 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-01-17 22:50:08 +0000 |
commit | 62b7cfb73e202051e7ab0dad42ba213acd0dec7e (patch) | |
tree | 538eaf3463957424716e658e8181dfea311ec2e8 /lib/Sema/SemaStmt.cpp | |
parent | 84760e3a5d885ab19b5d11aafe78dfdfe2911e3a (diff) |
Auto deduction support for std::initializer_list, including for-range support. This means you can now write:
for (int i : {1, 4, 512, 23, 251}) {}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 78a58964db..23dc7e9d20 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1164,7 +1164,7 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init, // Deduce the type for the iterator variable now rather than leaving it to // AddInitializerToDecl, so we can produce a more suitable diagnostic. TypeSourceInfo *InitTSI = 0; - if (Init->getType()->isVoidType() || + if ((!isa<InitListExpr>(Init) && Init->getType()->isVoidType()) || !SemaRef.DeduceAutoType(Decl->getTypeSourceInfo(), Init, InitTSI)) SemaRef.Diag(Loc, diag) << Init->getType(); if (!InitTSI) { |