diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-12 17:42:45 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-12 17:42:45 +0000 |
| commit | 66204ecff985f7a373b0435b339a341e9c559d4a (patch) | |
| tree | ca066ebb59b32a16ad5ca82fccb2561733d05b0c /clang/lib/Sema/SemaExprCXX.cpp | |
| parent | b5e41ea14448f0db10bd87398882c917e3321006 (diff) | |
| download | bcm5719-llvm-66204ecff985f7a373b0435b339a341e9c559d4a.tar.gz bcm5719-llvm-66204ecff985f7a373b0435b339a341e9c559d4a.zip | |
DR1346: a parenthesized braced-init-list cannot be used as the initializer when
performing auto type deduction.
llvm-svn: 203683
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 3fa5de1a77f..8b9c0e2cc7d 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1188,14 +1188,15 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, else if (Initializer && isa<ImplicitValueInitExpr>(Initializer)) HaveCompleteInit = true; - // C++11 [decl.spec.auto]p6. Deduce the type which 'auto' stands in for. + // C++11 [dcl.spec.auto]p6. Deduce the type which 'auto' stands in for. if (TypeMayContainAuto && AllocType->isUndeducedType()) { if (initStyle == CXXNewExpr::NoInit || NumInits == 0) return ExprError(Diag(StartLoc, diag::err_auto_new_requires_ctor_arg) << AllocType << TypeRange); - if (initStyle == CXXNewExpr::ListInit) + if (initStyle == CXXNewExpr::ListInit || + (NumInits == 1 && isa<InitListExpr>(Inits[0]))) return ExprError(Diag(Inits[0]->getLocStart(), - diag::err_auto_new_requires_parens) + diag::err_auto_new_list_init) << AllocType << TypeRange); if (NumInits > 1) { Expr *FirstBad = Inits[1]; |

